Skip to content

Commit

Permalink
Disable the history button in admin screen.
Browse files Browse the repository at this point in the history
Disable change on the following entities
1. Registrar
2. Registrant
3. RegistryPublishedPerson
4. RegistrantPerson
5. RegistrarPerson
  • Loading branch information
dhvander committed Sep 10, 2024
1 parent 991435d commit 9e6776b
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions request_a_govuk_domain/request/admin/model_admins.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,19 +559,31 @@ class FilterAndOrderByName(ModelAdmin):
actions_on_bottom = True


class RegistrarPersonAdmin(FilterAndOrderByName):
class DisableHistoryMixin:
"""
Disable change for the given entity, this in turn
disables the history button.
"""

def render_change_form(
self, request, context, add=False, change=False, form_url="", obj=None
):
return super().render_change_form(request, context, add, False, form_url, obj)


class RegistrarPersonAdmin(DisableHistoryMixin, FilterAndOrderByName):
model = RegistrarPerson


class RegistrantPersonAdmin(FilterAndOrderByName):
class RegistrantPersonAdmin(DisableHistoryMixin, FilterAndOrderByName):
model = RegistrantPerson


class RegistryPublishedPersonAdmin(FilterAndOrderByName):
class RegistryPublishedPersonAdmin(DisableHistoryMixin, FilterAndOrderByName):
model = RegistryPublishedPerson


class RegistrantAdmin(FilterAndOrderByName):
class RegistrantAdmin(DisableHistoryMixin, FilterAndOrderByName):
model = Registrant


Expand Down

0 comments on commit 9e6776b

Please sign in to comment.