fix city in queryset.
This commit is contained in:
parent
c90e19daaa
commit
c58ccb3977
1 changed files with 3 additions and 3 deletions
|
|
@ -21,7 +21,7 @@ def scope_instances_queryset(user, queryset=None):
|
|||
if profile.has_role(UserRoles.BROKER):
|
||||
return qs.filter(broker=profile.broker)
|
||||
if profile.has_role(UserRoles.ACCOUNTANT) or profile.has_role(UserRoles.MANAGER) or profile.has_role(UserRoles.WATER_RESOURCE_MANAGER):
|
||||
return qs.filter(broker__affairs__county=profile.county)
|
||||
return qs.filter(broker__affairs__county__city=profile.county.city)
|
||||
if profile.has_role(UserRoles.ADMIN):
|
||||
return qs
|
||||
# if profile.has_role(UserRoles.WATER_RESOURCE_MANAGER) or profile.has_role(UserRoles.HEADQUARTER):
|
||||
|
|
@ -70,7 +70,7 @@ def scope_wells_queryset(user, queryset=None):
|
|||
if profile.has_role(UserRoles.BROKER):
|
||||
return qs.filter(broker=profile.broker)
|
||||
if profile.has_role(UserRoles.ACCOUNTANT) or profile.has_role(UserRoles.MANAGER) or profile.has_role(UserRoles.WATER_RESOURCE_MANAGER):
|
||||
return qs.filter(broker__affairs__county=profile.county)
|
||||
return qs.filter(broker__affairs__county__city=profile.county.city)
|
||||
if profile.has_role(UserRoles.INSTALLER):
|
||||
# Wells that have instances assigned to this installer
|
||||
from installations.models import InstallationAssignment
|
||||
|
|
@ -103,7 +103,7 @@ def scope_customers_queryset(user, queryset=None):
|
|||
if profile.has_role(UserRoles.BROKER):
|
||||
return qs.filter(broker=profile.broker)
|
||||
if profile.has_role(UserRoles.ACCOUNTANT) or profile.has_role(UserRoles.MANAGER) or profile.has_role(UserRoles.WATER_RESOURCE_MANAGER):
|
||||
return qs.filter(county=profile.county)
|
||||
return qs.filter(county__city=profile.county.city)
|
||||
if profile.has_role(UserRoles.INSTALLER):
|
||||
# Customers that are representatives of instances assigned to this installer
|
||||
from installations.models import InstallationAssignment
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue