haikal/inventory/filters.py
2025-06-22 13:25:54 +03:00

25 lines
924 B
Python

from django_ledger.models import AccountModel
import django_filters
class AccountModelFilter(django_filters.FilterSet):
"""
Handles filtering functionality for the AccountModel.
This class is a subclass of `django_filters.FilterSet` and is used to provide
filtering capabilities for the `AccountModel` based on its specified fields such as
`code`, `name`, and `role`. It is designed to integrate seamlessly with Django's
filtering framework to simplify query creation and management for this specific model.
The Meta class inside defines the model and fields that can be used for filtering.
:ivar model: The model for which filters are being applied.
:type model: type[AccountModel]
:ivar fields: List of fields defined in the model that can be filtered.
:type fields: list(str)
"""
class Meta:
model = AccountModel
fields = ["code", "name", "role"]