mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 12:08:40 +02:00
Fix suborg issue
This commit is contained in:
parent
bd615a18a2
commit
60c4f54e63
3 changed files with 8 additions and 5 deletions
|
@ -189,10 +189,6 @@ class DomainSuborganizationForm(forms.ModelForm):
|
|||
if self.instance and self.instance.sub_organization:
|
||||
self.fields["sub_organization"].widget.attrs["data-default-value"] = self.instance.sub_organization.pk
|
||||
|
||||
def get_suborganization_name(self):
|
||||
"""Returns the suborganization name for the readonly view"""
|
||||
return self.instance.sub_organization.name if self.instance else None
|
||||
|
||||
|
||||
class BaseNameserverFormset(forms.BaseFormSet):
|
||||
def clean(self):
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</form>
|
||||
{% else %}
|
||||
{% with description="The suborganization for this domain can only be updated by a organization administrator."%}
|
||||
{% include "includes/input_read_only.html" with field=form.sub_organization value=instance.get_suborganization_name label_description=description%}
|
||||
{% include "includes/input_read_only.html" with field=form.sub_organization value=suborganization_name label_description=description%}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -250,6 +250,13 @@ class DomainSubOrganizationView(DomainFormBaseView):
|
|||
context_object_name = "domain"
|
||||
form_class = DomainSuborganizationForm
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Adds custom context."""
|
||||
context = super().get_context_data(**kwargs)
|
||||
if self.object and self.object.domain_info and self.object.domain_info.sub_organization:
|
||||
context["suborganization_name"] = self.object.domain_info.sub_organization.name
|
||||
return context
|
||||
|
||||
def get_form_kwargs(self, *args, **kwargs):
|
||||
"""Add domain_info.organization_name instance to make a bound form."""
|
||||
form_kwargs = super().get_form_kwargs(*args, **kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue