mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-16 17:47:02 +02:00
Merge branch 'main' into za/806-analyst-view-domain-management-data
This commit is contained in:
commit
a2572d0c73
26 changed files with 800 additions and 44 deletions
|
@ -4,13 +4,13 @@ from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
|||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.http.response import HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
from registrar.models.utility.admin_sort_fields import AdminSortFields
|
||||
from . import models
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AuditedAdmin(admin.ModelAdmin):
|
||||
|
||||
class AuditedAdmin(admin.ModelAdmin, AdminSortFields):
|
||||
"""Custom admin to make auditing easier."""
|
||||
|
||||
def history_view(self, request, object_id, extra_context=None):
|
||||
|
@ -23,9 +23,13 @@ class AuditedAdmin(admin.ModelAdmin):
|
|||
)
|
||||
)
|
||||
|
||||
def formfield_for_foreignkey(self, db_field, request, **kwargs):
|
||||
"""Used to sort dropdown fields alphabetically but can be expanded upon"""
|
||||
form_field = super().formfield_for_foreignkey(db_field, request, **kwargs)
|
||||
return self.form_field_order_helper(form_field, db_field)
|
||||
|
||||
|
||||
class ListHeaderAdmin(AuditedAdmin):
|
||||
|
||||
"""Custom admin to add a descriptive subheader to list views."""
|
||||
|
||||
def changelist_view(self, request, extra_context=None):
|
||||
|
@ -196,7 +200,6 @@ class DomainAdmin(ListHeaderAdmin):
|
|||
|
||||
|
||||
class ContactAdmin(ListHeaderAdmin):
|
||||
|
||||
"""Custom contact admin class to add search."""
|
||||
|
||||
search_fields = ["email", "first_name", "last_name"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue