mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 03:06:01 +02:00
Fix url bug
This commit is contained in:
parent
a128ebcf69
commit
14a1bd53ba
3 changed files with 14 additions and 7 deletions
|
@ -3186,10 +3186,11 @@ class PortfolioAdmin(ListHeaderAdmin):
|
||||||
extra_context = extra_context or {}
|
extra_context = extra_context or {}
|
||||||
extra_context["skip_additional_contact_info"] = True
|
extra_context["skip_additional_contact_info"] = True
|
||||||
|
|
||||||
extra_context["members"] = self.get_user_portfolio_permission_non_admins(obj)
|
if obj:
|
||||||
extra_context["admins"] = self.get_user_portfolio_permission_admins(obj)
|
extra_context["members"] = self.get_user_portfolio_permission_non_admins(obj)
|
||||||
extra_context["domains"] = obj.get_domains(order_by=["domain__name"])
|
extra_context["admins"] = self.get_user_portfolio_permission_admins(obj)
|
||||||
extra_context["domain_requests"] = obj.get_domain_requests(order_by=["requested_domain__name"])
|
extra_context["domains"] = obj.get_domains(order_by=["domain__name"])
|
||||||
|
extra_context["domain_requests"] = obj.get_domain_requests(order_by=["requested_domain__name"])
|
||||||
return super().change_view(request, object_id, form_url, extra_context)
|
return super().change_view(request, object_id, form_url, extra_context)
|
||||||
|
|
||||||
def save_model(self, request, obj, form, change):
|
def save_model(self, request, obj, form, change):
|
||||||
|
@ -3208,8 +3209,11 @@ class PortfolioAdmin(ListHeaderAdmin):
|
||||||
obj.organization_name = obj.federal_agency.agency
|
obj.organization_name = obj.federal_agency.agency
|
||||||
|
|
||||||
# Remove this line when senior_official is no longer readonly in /admin.
|
# Remove this line when senior_official is no longer readonly in /admin.
|
||||||
if obj.federal_agency and obj.federal_agency.so_federal_agency.exists():
|
if obj.federal_agency:
|
||||||
obj.senior_official = obj.federal_agency.so_federal_agency.first()
|
if obj.federal_agency.so_federal_agency.exists():
|
||||||
|
obj.senior_official = obj.federal_agency.so_federal_agency.first()
|
||||||
|
else:
|
||||||
|
obj.senior_official = None
|
||||||
|
|
||||||
super().save_model(request, obj, form, change)
|
super().save_model(request, obj, form, change)
|
||||||
|
|
||||||
|
|
|
@ -965,6 +965,7 @@ function initializeWidgetOnList(list, parentId) {
|
||||||
// If we can update the contact information, it'll be shown again.
|
// If we can update the contact information, it'll be shown again.
|
||||||
hideElement(contactList.parentElement);
|
hideElement(contactList.parentElement);
|
||||||
|
|
||||||
|
let seniorOfficialAddUrl = document.getElementById("senior-official-add-url").value;
|
||||||
let $seniorOfficial = django.jQuery("#id_senior_official");
|
let $seniorOfficial = django.jQuery("#id_senior_official");
|
||||||
let readonlySeniorOfficial = document.querySelector(".field-senior_official .readonly");
|
let readonlySeniorOfficial = document.querySelector(".field-senior_official .readonly");
|
||||||
let seniorOfficialApi = document.getElementById("senior_official_from_agency_json_url").value;
|
let seniorOfficialApi = document.getElementById("senior_official_from_agency_json_url").value;
|
||||||
|
@ -981,7 +982,7 @@ function initializeWidgetOnList(list, parentId) {
|
||||||
$seniorOfficial.val("").trigger("change");
|
$seniorOfficial.val("").trigger("change");
|
||||||
}else {
|
}else {
|
||||||
// Show the "create one now" text if this field is none in readonly mode.
|
// Show the "create one now" text if this field is none in readonly mode.
|
||||||
readonlySeniorOfficial.innerHTML = '<a href="admin/registrar/seniorofficial/add/">No senior official found. Create one now.</a>'
|
readonlySeniorOfficial.innerHTML = `<a href="${seniorOfficialAddUrl}">No senior official found. Create one now.</a>`;
|
||||||
}
|
}
|
||||||
console.warn("Record not found: " + data.error);
|
console.warn("Record not found: " + data.error);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
<input id="senior_official_from_agency_json_url" class="display-none" value="{{url}}" />
|
<input id="senior_official_from_agency_json_url" class="display-none" value="{{url}}" />
|
||||||
{% url 'get-federal-and-portfolio-types-from-federal-agency-json' as url %}
|
{% url 'get-federal-and-portfolio-types-from-federal-agency-json' as url %}
|
||||||
<input id="federal_and_portfolio_types_from_agency_json_url" class="display-none" value="{{url}}" />
|
<input id="federal_and_portfolio_types_from_agency_json_url" class="display-none" value="{{url}}" />
|
||||||
|
{% url "admin:registrar_seniorofficial_add" as url %}
|
||||||
|
<input id="senior-official-add-url" class="display-none" value="{{url}}" />
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue