mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-18 18:39:21 +02:00
Merge pull request #2545 from cisagov/ad/fix-creator-field-on-portfolio-page
#2480 - Creator field on portfolio page should not be selectable
This commit is contained in:
commit
e573b238ed
1 changed files with 4 additions and 1 deletions
|
@ -2840,6 +2840,9 @@ class PortfolioAdmin(ListHeaderAdmin):
|
|||
list_display = ("organization_name", "federal_agency", "creator")
|
||||
search_fields = ["organization_name"]
|
||||
search_help_text = "Search by organization name."
|
||||
readonly_fields = [
|
||||
"creator",
|
||||
]
|
||||
|
||||
# Creates select2 fields (with search bars)
|
||||
autocomplete_fields = [
|
||||
|
@ -2862,7 +2865,7 @@ class PortfolioAdmin(ListHeaderAdmin):
|
|||
|
||||
def save_model(self, request, obj, form, change):
|
||||
|
||||
if obj.creator is not None:
|
||||
if hasattr(obj, "creator") is False:
|
||||
# ---- update creator ----
|
||||
# Set the creator field to the current admin user
|
||||
obj.creator = request.user if request.user.is_authenticated else None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue