This commit is contained in:
zandercymatics 2024-07-23 15:04:22 -06:00
parent 73da16ec3a
commit 5879afa94b
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
7 changed files with 28 additions and 25 deletions

View file

@ -1980,4 +1980,4 @@ document.addEventListener('DOMContentLoaded', function() {
}
});
});
})();
})();

View file

@ -527,19 +527,16 @@ class DomainSuborganizationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.instance and self.instance.portfolio:
self.fields['sub_organization'].queryset = Suborganization.objects.filter(
portfolio=self.instance.portfolio
)
self.fields["sub_organization"].queryset = Suborganization.objects.filter(portfolio=self.instance.portfolio)
# Set custom form label
self.fields["sub_organization"].label = "Suborganization name"
# Use the combobox rather than the regular select widget
self.fields['sub_organization'].widget.template_name = "django/forms/widgets/combobox.html"
self.fields["sub_organization"].widget.template_name = "django/forms/widgets/combobox.html"
# TODO: Remove in #2352
DomainHelper.disable_field(self.fields['sub_organization'], disable_required=True)
DomainHelper.disable_field(self.fields["sub_organization"], disable_required=True)
class DomainDnssecForm(forms.Form):

View file

@ -1,3 +1,3 @@
<div class="usa-combo-box">
{% include "django/forms/widgets/select.html" %}
</div>
</div>

View file

@ -8,6 +8,16 @@
{% include "includes/domain_sidenav_item.html" with item_text="Domain overview" %}
{% endwith %}
{% if portfolio %}
{% with url_name="domain-suborganization" %}
{% include "includes/domain_sidenav_item.html" with item_text="Suborganization" %}
{% endwith %}
{% else %}
{% with url_name="domain-org-name-address" %}
{% include "includes/domain_sidenav_item.html" with item_text="Organization name and mailing address" %}
{% endwith %}
{% endif %}
{% if domain.is_editable %}
<li class="usa-sidenav__item">
{% url 'domain-dns' pk=domain.id as url %}
@ -50,16 +60,6 @@
</ul>
{% endif %}
</li>
{% if portfolio %}
{% with url_name="domain-suborganization" %}
{% include "includes/domain_sidenav_item.html" with item_text="Suborganization" %}
{% endwith %}
{% else %}
{% with url_name="domain-org-name-address" %}
{% include "includes/domain_sidenav_item.html" with item_text="Organization name and mailing address" %}
{% endwith %}
{% endif %}
{% with url_name="domain-senior-official" %}
{% include "includes/domain_sidenav_item.html" with item_text="Senior official" %}

View file

@ -5,4 +5,4 @@
>
{{ item_text }}
</a>
</li>
</li>

View file

@ -67,10 +67,8 @@ error messages, if necessary.
{% include "includes/readonly_input.html" %}
{% endif %}
{# this is the input field, itself. Toggleable because of the show_readonly flag. #}
{% if not remove_input_field %}
{% include widget.template_name %}
{% endif %}
{# this is the input field, itself #}
{% include widget.template_name %}
{% if append_gov %}
<span class="padding-top-05 padding-left-2px">.gov </span>

View file

@ -25,6 +25,7 @@ from registrar.models import (
User,
UserDomainRole,
)
from registrar.models.portfolio import Portfolio
from registrar.models.public_contact import PublicContact
from registrar.models.utility.domain_helper import DomainHelper
from registrar.utility.enums import DefaultEmail
@ -272,7 +273,14 @@ class DomainSeniorOfficialView(DomainFormBaseView):
def get_form_kwargs(self, *args, **kwargs):
"""Add domain_info.senior_official instance to make a bound form."""
form_kwargs = super().get_form_kwargs(*args, **kwargs)
form_kwargs["instance"] = self.object.domain_info.senior_official
org_user = self.request.user.is_org_user(self.request)
if org_user:
portfolio = Portfolio.objects.filter(information_portfolio=self.object.domain_info).first()
senior_official = portfolio.senior_official if portfolio else None
else:
senior_official = self.object.domain_info.senior_official
form_kwargs["instance"] = senior_official
domain_info = self.get_domain_info_from_domain()
invalid_fields = [DomainRequest.OrganizationChoices.FEDERAL, DomainRequest.OrganizationChoices.TRIBAL]