You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.6 KiB
55 lines
1.6 KiB
from rest_framework_filters import FilterSet, RelatedFilter, AllLookupsFilter
|
|
|
|
from .models import Project, Realty, BuildingClassfication, ConstructionType
|
|
|
|
|
|
class BuildingClassficationFilterSet(FilterSet):
|
|
id = AllLookupsFilter()
|
|
name = AllLookupsFilter()
|
|
|
|
class Meta:
|
|
model = BuildingClassfication
|
|
|
|
|
|
class ConstructionTypeFilterSet(FilterSet):
|
|
id = AllLookupsFilter()
|
|
name = AllLookupsFilter()
|
|
|
|
class Meta:
|
|
model = ConstructionType
|
|
|
|
|
|
class ProjectFilterSet(FilterSet):
|
|
budget = AllLookupsFilter()
|
|
budget_by_agreement = AllLookupsFilter()
|
|
created = AllLookupsFilter()
|
|
cro = AllLookupsFilter()
|
|
currency = AllLookupsFilter()
|
|
deal_type = AllLookupsFilter()
|
|
name = AllLookupsFilter()
|
|
price_and_term_required = AllLookupsFilter()
|
|
state = AllLookupsFilter()
|
|
term = AllLookupsFilter()
|
|
term_type = AllLookupsFilter()
|
|
text = AllLookupsFilter()
|
|
work_type = AllLookupsFilter()
|
|
|
|
customer = RelatedFilter('users.filters.UserFilterSet')
|
|
realty = RelatedFilter('projects.filters.RealtyFilterSet')
|
|
specialization = RelatedFilter('specializations.filters.SpecializationFilterSet')
|
|
|
|
class Meta:
|
|
model = Project
|
|
|
|
|
|
class RealtyFilterSet(FilterSet):
|
|
id = AllLookupsFilter()
|
|
name = AllLookupsFilter()
|
|
|
|
building_classification = RelatedFilter('projects.filters.BuildingClassficationFilterSet')
|
|
construction_type = RelatedFilter('projects.filters.ConstructionTypeFilterSet')
|
|
location = RelatedFilter('common.filters.LocationFilterSet')
|
|
user = RelatedFilter('users.filters.UserFilterSet')
|
|
|
|
class Meta:
|
|
model = Realty
|
|
|