mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 17:28:31 +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
|
@ -191,6 +191,10 @@ class DomainSuborganizationForm(forms.ModelForm):
|
|||
|
||||
# Use the combobox rather than the regular select widget
|
||||
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):
|
||||
|
|
|
@ -23,7 +23,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 label_description=description%}
|
||||
{% include "includes/input_read_only.html" with field=form.sub_organization value=instance.get_suborganization_name label_description=description%}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -7,4 +7,8 @@ Template include for read-only form fields
|
|||
{% if label_description %}
|
||||
<p class="usa-hint margin-top-0 margin-bottom-05">{{ label_description }}</p>
|
||||
{% 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