mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-19 19:09:22 +02:00
Merge pull request #1927 from cisagov/za/1852-user-contact-info-inline
(on getgov-za) Ticket #1852 / #1836: Contact info inline + Remove unnecessary and "dangerous" multi-selects
This commit is contained in:
commit
9e4b48a84b
12 changed files with 704 additions and 62 deletions
|
@ -910,6 +910,9 @@ class DomainInformationAdmin(ListHeaderAdmin):
|
|||
),
|
||||
]
|
||||
|
||||
# Readonly fields for analysts and superusers
|
||||
readonly_fields = ("other_contacts",)
|
||||
|
||||
# Read only that we'll leverage for CISA Analysts
|
||||
analyst_readonly_fields = [
|
||||
"creator",
|
||||
|
@ -938,6 +941,8 @@ class DomainInformationAdmin(ListHeaderAdmin):
|
|||
# Table ordering
|
||||
ordering = ["domain__name"]
|
||||
|
||||
change_form_template = "django/admin/domain_information_change_form.html"
|
||||
|
||||
def get_readonly_fields(self, request, obj=None):
|
||||
"""Set the read-only state on form elements.
|
||||
We have 1 conditions that determine which fields are read-only:
|
||||
|
@ -1117,6 +1122,9 @@ class DomainRequestAdmin(ListHeaderAdmin):
|
|||
),
|
||||
]
|
||||
|
||||
# Readonly fields for analysts and superusers
|
||||
readonly_fields = ("other_contacts", "current_websites", "alternative_domains")
|
||||
|
||||
# Read only that we'll leverage for CISA Analysts
|
||||
analyst_readonly_fields = [
|
||||
"creator",
|
||||
|
@ -1143,6 +1151,8 @@ class DomainRequestAdmin(ListHeaderAdmin):
|
|||
# Table ordering
|
||||
ordering = ["requested_domain__name"]
|
||||
|
||||
change_form_template = "django/admin/domain_request_change_form.html"
|
||||
|
||||
# Trigger action when a fieldset is changed
|
||||
def save_model(self, request, obj, form, change):
|
||||
"""Custom save_model definition that handles edge cases"""
|
||||
|
@ -1297,7 +1307,7 @@ class DomainRequestAdmin(ListHeaderAdmin):
|
|||
readonly_fields.extend([field.name for field in self.model._meta.fields])
|
||||
# Add the multi-select fields to readonly_fields:
|
||||
# Complex fields like ManyToManyField require special handling
|
||||
readonly_fields.extend(["current_websites", "other_contacts", "alternative_domains"])
|
||||
readonly_fields.extend(["alternative_domains"])
|
||||
|
||||
if request.user.has_perm("registrar.full_access_permission"):
|
||||
return readonly_fields
|
||||
|
@ -1408,7 +1418,6 @@ class DomainAdmin(ListHeaderAdmin):
|
|||
)
|
||||
|
||||
def queryset(self, request, queryset):
|
||||
logger.debug(self.value())
|
||||
if self.value() == "1":
|
||||
return queryset.filter(domain_info__is_election_board=True)
|
||||
if self.value() == "0":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue