mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 01:57:03 +02:00
fixing unit tests to reflect new read-only fields
This commit is contained in:
parent
27555706a6
commit
1c05dbfbb6
2 changed files with 20 additions and 7 deletions
|
@ -9,6 +9,8 @@ from django.db.models.functions import Concat, Coalesce
|
|||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import redirect
|
||||
from django_fsm import get_available_FIELD_transitions, FSMField
|
||||
from registrar.models.domain_group import DomainGroup
|
||||
from registrar.models.suborganization import Suborganization
|
||||
from waffle.decorators import flag_is_active
|
||||
from django.contrib import admin, messages
|
||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||
|
@ -2686,21 +2688,33 @@ class VerifiedByStaffAdmin(ListHeaderAdmin):
|
|||
obj.requestor = request.user if request.user.is_authenticated else None
|
||||
super().save_model(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.
|
||||
|
||||
change_form_template = "django/admin/portfolio_change_form.html"
|
||||
|
||||
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",
|
||||
"federal_agency",
|
||||
]
|
||||
|
||||
def change_view(self, request, object_id, form_url="", extra_context=None):
|
||||
"""Add related suborganizations and domain groups"""
|
||||
obj = self.get_object(request, object_id)
|
||||
|
||||
# ---- Domain Groups
|
||||
domain_groups = DomainGroup.objects.filter(portfolio=obj)
|
||||
|
||||
# ---- Suborganizations
|
||||
suborganizations = Suborganization.objects.filter(portfolio=obj)
|
||||
|
||||
extra_context = {"domain_groups": domain_groups, "suborganizations": suborganizations}
|
||||
return super().change_view(request, object_id, form_url, extra_context)
|
||||
|
||||
def save_model(self, request, obj, form, change):
|
||||
|
||||
if obj.creator is not None:
|
||||
|
|
|
@ -2328,9 +2328,9 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
"current_websites",
|
||||
"alternative_domains",
|
||||
"is_election_board",
|
||||
"federal_agency",
|
||||
"status_history",
|
||||
"action_needed_reason_email",
|
||||
"federal_agency",
|
||||
"creator",
|
||||
"about_your_organization",
|
||||
"requested_domain",
|
||||
|
@ -2360,7 +2360,6 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
"current_websites",
|
||||
"alternative_domains",
|
||||
"is_election_board",
|
||||
"federal_agency",
|
||||
"status_history",
|
||||
"action_needed_reason_email",
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue