mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-16 22:44:11 +02:00
Display name rather than id
This commit is contained in:
parent
a1c63a809d
commit
6a0412d872
3 changed files with 10 additions and 2 deletions
|
@ -192,6 +192,10 @@ class DomainSuborganizationForm(forms.ModelForm):
|
||||||
# Use the combobox rather than the regular select widget
|
# 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"
|
||||||
|
|
||||||
|
def get_suborganization_name(self):
|
||||||
|
"""Returns the suborganization name for the readonly view"""
|
||||||
|
return self.instance.sub_organization if self.instance else None
|
||||||
|
|
||||||
|
|
||||||
class BaseNameserverFormset(forms.BaseFormSet):
|
class BaseNameserverFormset(forms.BaseFormSet):
|
||||||
def clean(self):
|
def clean(self):
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% with description="The suborganization for this domain can only be updated by a organization administrator."%}
|
{% 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 label_description=description%}
|
{% include "includes/input_read_only.html" with field=form.sub_organization value=instance.get_suborganization_name label_description=description%}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,8 @@ Template include for read-only form fields
|
||||||
{% if label_description %}
|
{% if label_description %}
|
||||||
<p class="usa-hint margin-top-0 margin-bottom-05">{{ label_description }}</p>
|
<p class="usa-hint margin-top-0 margin-bottom-05">{{ label_description }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p class="read-only-value">{{ field.value }}</p>
|
{% comment %}
|
||||||
|
This allows us to customize the displayed value.
|
||||||
|
For instance, Select fields will display the id by default.
|
||||||
|
{% endcomment %}
|
||||||
|
<p class="read-only-value">{{ value|default:field.value }}</p>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue