File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,10 @@ def user(request):
161161@user_passes_test (lambda u : u .is_staff )
162162def add_user (request ):
163163 form = AddDojoUserForm ()
164+ if not request .user .is_superuser :
165+ form .fields ['is_staff' ].widget .attrs ['disabled' ] = True
166+ form .fields ['is_superuser' ].widget .attrs ['disabled' ] = True
167+ form .fields ['is_active' ].widget .attrs ['disabled' ] = True
164168 contact_form = UserContactInfoForm ()
165169 user = None
166170
@@ -202,6 +206,10 @@ def edit_user(request, uid):
202206 user = get_object_or_404 (Dojo_User , id = uid )
203207 authed_products = Product .objects .filter (authorized_users__in = [user ])
204208 form = AddDojoUserForm (instance = user , initial = {'authorized_products' : authed_products })
209+ if not request .user .is_superuser :
210+ form .fields ['is_staff' ].widget .attrs ['disabled' ] = True
211+ form .fields ['is_superuser' ].widget .attrs ['disabled' ] = True
212+ form .fields ['is_active' ].widget .attrs ['disabled' ] = True
205213 try :
206214 user_contact = UserContactInfo .objects .get (user = user )
207215 except UserContactInfo .DoesNotExist :
You can’t perform that action at this time.
0 commit comments