Skip to content

Commit

Permalink
Merge pull request #2445 from cisagov/nl/2426-federal-agency-read-onl…
Browse files Browse the repository at this point in the history
…y-bug

Issue #2426  - fixes federal agency read only bug [rb]
  • Loading branch information
CocoByte authored Jul 24, 2024
2 parents af45eb5 + b7622a0 commit e8d93bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 5 additions & 6 deletions src/registrar/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,10 +1389,11 @@ class DomainInformationAdmin(ListHeaderAdmin, ImportExportModelAdmin):
]

# Readonly fields for analysts and superusers
readonly_fields = ("other_contacts", "is_election_board", "federal_agency")
readonly_fields = ("other_contacts", "is_election_board")

# Read only that we'll leverage for CISA Analysts
analyst_readonly_fields = [
"federal_agency",
"creator",
"type_of_work",
"more_organization_information",
Expand Down Expand Up @@ -1705,12 +1706,12 @@ def status_history(self, obj):
"current_websites",
"alternative_domains",
"is_election_board",
"federal_agency",
"status_history",
)

# Read only that we'll leverage for CISA Analysts
analyst_readonly_fields = [
"federal_agency",
"creator",
"about_your_organization",
"requested_domain",
Expand Down Expand Up @@ -2763,13 +2764,11 @@ def save_model(self, request, obj, form, change):


class PortfolioAdmin(ListHeaderAdmin):
# NOTE: these are just placeholders. Not part of ACs (haven't been defined yet). Update in future tickets.

list_display = ("organization_name", "federal_agency", "creator")
search_fields = ["organization_name"]
search_help_text = "Search by organization name."
# readonly_fields = [
# "requestor",
# ]

# Creates select2 fields (with search bars)
autocomplete_fields = [
"creator",
Expand Down
4 changes: 1 addition & 3 deletions src/registrar/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2305,7 +2305,6 @@ def test_readonly_when_restricted_creator(self):
"current_websites",
"alternative_domains",
"is_election_board",
"federal_agency",
"status_history",
"id",
"created_at",
Expand Down Expand Up @@ -2366,8 +2365,8 @@ def test_readonly_fields_for_analyst(self):
"current_websites",
"alternative_domains",
"is_election_board",
"federal_agency",
"status_history",
"federal_agency",
"creator",
"about_your_organization",
"requested_domain",
Expand Down Expand Up @@ -2397,7 +2396,6 @@ def test_readonly_fields_for_superuser(self):
"current_websites",
"alternative_domains",
"is_election_board",
"federal_agency",
"status_history",
]

Expand Down

0 comments on commit e8d93bc

Please sign in to comment.