Правки логики
This commit is contained in:
@@ -69,7 +69,7 @@ class PortalPharmacyEditForm(forms.ModelForm):
|
||||
'curator': forms.Select(attrs={'class': 'input'}),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
def __init__(self, *args, user=None, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
from apps.employees.models import Employee
|
||||
|
||||
@@ -98,3 +98,7 @@ class PortalPharmacyEditForm(forms.ModelForm):
|
||||
self.fields['building'].required = False
|
||||
self.fields['apartment'].required = False
|
||||
self.fields['location'].required = False
|
||||
|
||||
if user is not None and not user.has_perm('locations.manage_location_access'):
|
||||
for field in ('head_pharmacist', 'responsible_manager', 'curator'):
|
||||
self.fields.pop(field, None)
|
||||
|
||||
Reference in New Issue
Block a user