mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-16 09:37:03 +02:00
implement filter_horizontal on other contacts on inline DomainInfo
This commit is contained in:
parent
682ad5640b
commit
7904ca0cc4
1 changed files with 5 additions and 4 deletions
|
@ -455,7 +455,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
|
||||||
"is_policy_acknowledged",
|
"is_policy_acknowledged",
|
||||||
]
|
]
|
||||||
|
|
||||||
filter_horizontal = ('other_contacts',)
|
filter_horizontal = ("other_contacts",)
|
||||||
|
|
||||||
def get_readonly_fields(self, request, obj=None):
|
def get_readonly_fields(self, request, obj=None):
|
||||||
"""Set the read-only state on form elements.
|
"""Set the read-only state on form elements.
|
||||||
|
@ -593,13 +593,13 @@ class DomainApplicationAdmin(ListHeaderAdmin):
|
||||||
"is_policy_acknowledged",
|
"is_policy_acknowledged",
|
||||||
]
|
]
|
||||||
|
|
||||||
filter_horizontal = ('current_websites', 'alternative_domains')
|
filter_horizontal = ("current_websites", "alternative_domains")
|
||||||
|
|
||||||
# lists in filter_horizontal are not sorted properly, sort them
|
# lists in filter_horizontal are not sorted properly, sort them
|
||||||
# by website
|
# by website
|
||||||
def formfield_for_manytomany(self, db_field, request, **kwargs):
|
def formfield_for_manytomany(self, db_field, request, **kwargs):
|
||||||
if db_field.name in ("current_websites", "alternative_domains"):
|
if db_field.name in ("current_websites", "alternative_domains"):
|
||||||
kwargs["queryset"] = models.Website.objects.all().order_by('website') # Sort websites
|
kwargs["queryset"] = models.Website.objects.all().order_by("website") # Sort websites
|
||||||
return super().formfield_for_manytomany(db_field, request, **kwargs)
|
return super().formfield_for_manytomany(db_field, request, **kwargs)
|
||||||
|
|
||||||
# Trigger action when a fieldset is changed
|
# Trigger action when a fieldset is changed
|
||||||
|
@ -730,6 +730,7 @@ class DomainInformationInline(admin.StackedInline):
|
||||||
|
|
||||||
fieldsets = DomainInformationAdmin.fieldsets
|
fieldsets = DomainInformationAdmin.fieldsets
|
||||||
analyst_readonly_fields = DomainInformationAdmin.analyst_readonly_fields
|
analyst_readonly_fields = DomainInformationAdmin.analyst_readonly_fields
|
||||||
|
filter_horizontal = ("other_contacts",)
|
||||||
|
|
||||||
def get_readonly_fields(self, request, obj=None):
|
def get_readonly_fields(self, request, obj=None):
|
||||||
return DomainInformationAdmin.get_readonly_fields(self, request, obj=None)
|
return DomainInformationAdmin.get_readonly_fields(self, request, obj=None)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue