|
|
|
|
@ -34,16 +34,13 @@ class UserListView(ListView): |
|
|
|
|
class ContractorFilterView(BaseMixin, View): |
|
|
|
|
template_name = 'contractor_filter.html' |
|
|
|
|
form_class = ContractorFilterForm |
|
|
|
|
# realty_form = ProjectFilterRealtyForm |
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
form = self.form_class(request.GET, request=request) |
|
|
|
|
# realty_form = self.realty_form(request.GET, request=request, prefix='realty_form') |
|
|
|
|
context = self.get_context_data(**_.merge({}, request.GET, kwargs)) |
|
|
|
|
|
|
|
|
|
contractors = User.contractor_objects |
|
|
|
|
|
|
|
|
|
# if form.is_valid() and realty_form.is_valid(): |
|
|
|
|
if form.is_valid(): |
|
|
|
|
# keywords = form.cleaned_data.get('keywords') |
|
|
|
|
# cro = form.cleaned_data.get('cro') |
|
|
|
|
@ -54,6 +51,8 @@ class ContractorFilterView(BaseMixin, View): |
|
|
|
|
# construction_type = realty_form.cleaned_data.get('construction_type') |
|
|
|
|
location = form.cleaned_data.get('location') |
|
|
|
|
|
|
|
|
|
build_classif = form.cleaned_data.get('building_classification') |
|
|
|
|
|
|
|
|
|
# if keywords: |
|
|
|
|
# keywords = tuple(filter(None, re.split(r'\s|,|;', keywords))) |
|
|
|
|
# |
|
|
|
|
@ -85,6 +84,10 @@ class ContractorFilterView(BaseMixin, View): |
|
|
|
|
location__rght__lte=location.rght, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
if build_classif: |
|
|
|
|
contractors = contractors.filter(orders__project__realty__building_classification=build_classif) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# order_by = form.cleaned_data.get('order_by') |
|
|
|
|
# last_order_by = form.cleaned_data.get('last_order_by') |
|
|
|
|
# reverse_order = form.cleaned_data.get('reverse_order') |
|
|
|
|
|