diff --git a/projects/forms.py b/projects/forms.py index 7beb824..476efa4 100644 --- a/projects/forms.py +++ b/projects/forms.py @@ -35,8 +35,10 @@ class ProjectFilterForm(forms.ModelForm): fields = ( 'cro', - 'specialization', 'work_type', + + 'realty', + 'specialization', ) widgets = { diff --git a/projects/serializers.py b/projects/serializers.py index 8c97bdd..33ffff6 100755 --- a/projects/serializers.py +++ b/projects/serializers.py @@ -67,11 +67,12 @@ class RealtySerializer(ModelSerializer): model = Realty fields = ( + 'id', + 'name', + 'building_classification', 'construction_type', - 'id', 'location', - 'name', 'user', ) diff --git a/projects/templates/project_filter.html b/projects/templates/project_filter.html index 4b85d61..722bdf5 100644 --- a/projects/templates/project_filter.html +++ b/projects/templates/project_filter.html @@ -185,7 +185,7 @@ {% if project.realty and project.realty.name %} {% endif %} diff --git a/projects/views.py b/projects/views.py index 26b8f1c..3471496 100644 --- a/projects/views.py +++ b/projects/views.py @@ -288,6 +288,7 @@ class ProjectFilterView(BaseMixin, View): cro = form.cleaned_data.get('cro') work_type = form.cleaned_data.get('work_type') specialization = form.cleaned_data.get('specialization') + realty = form.cleaned_data.get('realty') building_classification = realty_form.cleaned_data.get('building_classification') construction_type = realty_form.cleaned_data.get('construction_type') @@ -322,6 +323,9 @@ class ProjectFilterView(BaseMixin, View): realty__location__lft__gte=location.lft, realty__location__rght__lte=location.rght, ) + + if realty: + projects = projects.filter(realty=realty) order_by = form.cleaned_data.get('order_by') last_order_by = form.cleaned_data.get('last_order_by')