mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 01:57:03 +02:00
Merge remote-tracking branch 'origin/main' into nl/2300-Senior-Official-Table
This commit is contained in:
commit
269c8d641d
6 changed files with 155 additions and 117 deletions
|
@ -9,6 +9,7 @@ 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 waffle.decorators import flag_is_active
|
||||
from django.contrib import admin, messages
|
||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||
from django.contrib.auth.models import Group
|
||||
|
@ -166,6 +167,9 @@ class DomainRequestAdminForm(forms.ModelForm):
|
|||
"alternative_domains": NoAutocompleteFilteredSelectMultiple("alternative_domains", False),
|
||||
"other_contacts": NoAutocompleteFilteredSelectMultiple("other_contacts", False),
|
||||
}
|
||||
labels = {
|
||||
"action_needed_reason_email": "Auto-generated email",
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -1522,6 +1526,13 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
custom_election_board.admin_order_field = "is_election_board" # type: ignore
|
||||
custom_election_board.short_description = "Election office" # type: ignore
|
||||
|
||||
# This is just a placeholder. This field will be populated in the detail_table_fieldset view.
|
||||
# This is not a field that exists on the model.
|
||||
def status_history(self, obj):
|
||||
return "No changelog to display."
|
||||
|
||||
status_history.short_description = "Status History" # type: ignore
|
||||
|
||||
# Filters
|
||||
list_filter = (
|
||||
StatusListFilter,
|
||||
|
@ -1548,9 +1559,11 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
"fields": [
|
||||
"portfolio",
|
||||
"sub_organization",
|
||||
"status_history",
|
||||
"status",
|
||||
"rejection_reason",
|
||||
"action_needed_reason",
|
||||
"action_needed_reason_email",
|
||||
"investigator",
|
||||
"creator",
|
||||
"submitter",
|
||||
|
@ -1630,6 +1643,8 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
"alternative_domains",
|
||||
"is_election_board",
|
||||
"federal_agency",
|
||||
"status_history",
|
||||
"action_needed_reason_email",
|
||||
)
|
||||
|
||||
# Read only that we'll leverage for CISA Analysts
|
||||
|
@ -1948,6 +1963,7 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
extra_context = extra_context or {}
|
||||
extra_context["filtered_audit_log_entries"] = filtered_audit_log_entries
|
||||
extra_context["action_needed_reason_emails"] = self.get_all_action_needed_reason_emails_as_json(obj)
|
||||
extra_context["has_profile_feature_flag"] = flag_is_active(request, "profile_feature")
|
||||
|
||||
# Call the superclass method with updated extra_context
|
||||
return super().change_view(request, object_id, form_url, extra_context)
|
||||
|
@ -1978,9 +1994,13 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
template_subject_path = f"emails/action_needed_reasons/{action_needed_reason}_subject.txt"
|
||||
subject_template = get_template(template_subject_path)
|
||||
|
||||
# Return the content of the rendered views
|
||||
context = {"domain_request": domain_request}
|
||||
if flag_is_active(None, "profile_feature"): # type: ignore
|
||||
recipient = domain_request.creator
|
||||
else:
|
||||
recipient = domain_request.submitter
|
||||
|
||||
# Return the content of the rendered views
|
||||
context = {"domain_request": domain_request, "recipient": recipient}
|
||||
return {
|
||||
"subject_text": subject_template.render(context=context),
|
||||
"email_body_text": template.render(context=context),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue