mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
make some fields read only for non superusers
This commit is contained in:
parent
6d46785962
commit
963feef9b4
1 changed files with 10 additions and 0 deletions
|
@ -134,6 +134,16 @@ class DomainApplicationAdmin(AuditedAdmin):
|
||||||
original_obj.in_review(obj)
|
original_obj.in_review(obj)
|
||||||
|
|
||||||
super().save_model(request, obj, form, change)
|
super().save_model(request, obj, form, change)
|
||||||
|
|
||||||
|
readonly_fields = ["status", "creator", "submitter", "is_policy_acknowledged"]
|
||||||
|
|
||||||
|
def get_readonly_fields(self, request, obj=None):
|
||||||
|
if request.user.is_superuser:
|
||||||
|
# Superusers have full access, no fields are read-only
|
||||||
|
return ()
|
||||||
|
else:
|
||||||
|
# Regular users can only view the specified fields
|
||||||
|
return self.readonly_fields
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(models.User, MyUserAdmin)
|
admin.site.register(models.User, MyUserAdmin)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue