|
|
|
@ -629,7 +629,9 @@ class CustomerProfileOpenProjectsView(BaseMixin, View): |
|
|
|
order__team__isnull=True) |
|
|
|
order__team__isnull=True) |
|
|
|
trashed_projects = customer.customer_projects.filter(state='trashed', order__contractor__isnull=True, |
|
|
|
trashed_projects = customer.customer_projects.filter(state='trashed', order__contractor__isnull=True, |
|
|
|
order__team__isnull=True) |
|
|
|
order__team__isnull=True) |
|
|
|
|
|
|
|
# @Add fast |
|
|
|
|
|
|
|
num_current_projects = customer.customer_projects.filter(state='active').exclude(order__contractor__isnull=True, |
|
|
|
|
|
|
|
order__team__isnull=True).count() |
|
|
|
if form.is_valid(): |
|
|
|
if form.is_valid(): |
|
|
|
realty = form.cleaned_data.get('realty') |
|
|
|
realty = form.cleaned_data.get('realty') |
|
|
|
|
|
|
|
|
|
|
|
@ -661,7 +663,7 @@ class CustomerProfileOpenProjectsView(BaseMixin, View): |
|
|
|
|
|
|
|
|
|
|
|
'open_project_count': projects.paginator.count, |
|
|
|
'open_project_count': projects.paginator.count, |
|
|
|
'trashed_project_count': trashed_projects.count(), |
|
|
|
'trashed_project_count': trashed_projects.count(), |
|
|
|
|
|
|
|
'num_current_projects': num_current_projects, |
|
|
|
'is_paginated': True, |
|
|
|
'is_paginated': True, |
|
|
|
'page_obj': projects, |
|
|
|
'page_obj': projects, |
|
|
|
}) |
|
|
|
}) |
|
|
|
@ -740,6 +742,7 @@ class CustomerProfileCurrentProjectsView(BaseMixin, View): |
|
|
|
projects = customer.customer_projects.filter(state='active').exclude(order__contractor__isnull=True, |
|
|
|
projects = customer.customer_projects.filter(state='active').exclude(order__contractor__isnull=True, |
|
|
|
order__team__isnull=True) |
|
|
|
order__team__isnull=True) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
num_current_projects = projects.count() |
|
|
|
# trashed_projects = customer.customer_projects.filter(state='trashed') |
|
|
|
# trashed_projects = customer.customer_projects.filter(state='trashed') |
|
|
|
|
|
|
|
|
|
|
|
paginator = Paginator(projects, settings.PAGE_SIZE) |
|
|
|
paginator = Paginator(projects, settings.PAGE_SIZE) |
|
|
|
@ -755,7 +758,7 @@ class CustomerProfileCurrentProjectsView(BaseMixin, View): |
|
|
|
context.update({ |
|
|
|
context.update({ |
|
|
|
'projects': projects, |
|
|
|
'projects': projects, |
|
|
|
'customer': customer, |
|
|
|
'customer': customer, |
|
|
|
|
|
|
|
'num_current_projects': num_current_projects, |
|
|
|
# 'open_project_count': projects.paginator.count, |
|
|
|
# 'open_project_count': projects.paginator.count, |
|
|
|
# 'trashed_project_count': trashed_projects.count(), |
|
|
|
# 'trashed_project_count': trashed_projects.count(), |
|
|
|
|
|
|
|
|
|
|
|
@ -859,9 +862,14 @@ class CustomerProfileReviewsView(BaseMixin, View): |
|
|
|
customer = get_object_or_404(User.customer_objects, pk=self.kwargs['pk']) |
|
|
|
customer = get_object_or_404(User.customer_objects, pk=self.kwargs['pk']) |
|
|
|
reviews = Review.objects.filter(target_customer=customer) |
|
|
|
reviews = Review.objects.filter(target_customer=customer) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# @Add fast |
|
|
|
|
|
|
|
num_current_projects = customer.customer_projects.filter(state='active').exclude(order__contractor__isnull=True, |
|
|
|
|
|
|
|
order__team__isnull=True).count() |
|
|
|
|
|
|
|
|
|
|
|
context.update({ |
|
|
|
context.update({ |
|
|
|
'reviews': reviews, |
|
|
|
'reviews': reviews, |
|
|
|
'customer': customer, |
|
|
|
'customer': customer, |
|
|
|
|
|
|
|
'num_current_projects': num_current_projects |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
return render(request, self.template_name, context) |
|
|
|
return render(request, self.template_name, context) |
|
|
|
|