migrations

This commit is contained in:
CocoByte 2024-06-12 17:05:22 -06:00
parent c9c6890e7d
commit de926b1abb
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
7 changed files with 261 additions and 100 deletions

View file

@ -2465,18 +2465,29 @@ class VerifiedByStaffAdmin(ListHeaderAdmin):
class PortfolioAdmin(ListHeaderAdmin):
# list_display = ("email", "requestor", "truncated_notes", "created_at")
# search_fields = ["email"]
# search_help_text = "Search by email."
# 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",
# ]
# change_form_template = "django/admin/email_clipboard_change_form.html"
def save_model(self, request, obj, form, change):
# ---- update creator ----
# Set the creator field to the current admin user
obj.creator = request.user if request.user.is_authenticated else None
# ---- update organization name ----
# org name will be the same as federal agency, if it is federal,
# otherwise it will be the actual org name. If nothing is entered for
# org name and it is a federal organization, have this field fill with
# the federal agency text name.
is_federal = obj.organization_type == DomainRequest.OrganizationChoices.FEDERAL
if is_federal:
obj.organization_name = obj.organization_type
#NOTE: What is meant by "federal agency text name?"
super().save_model(request, obj, form, change)
@ -2551,6 +2562,7 @@ admin.site.register(models.PublicContact, PublicContactAdmin)
admin.site.register(models.DomainRequest, DomainRequestAdmin)
admin.site.register(models.TransitionDomain, TransitionDomainAdmin)
admin.site.register(models.VerifiedByStaff, VerifiedByStaffAdmin)
admin.site.register(models.Portfolio, PortfolioAdmin)
# Register our custom waffle implementations
admin.site.register(models.WaffleFlag, WaffleFlagAdmin)