mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 18:56:15 +02:00
Add readonly mode
This commit is contained in:
parent
7f36e6270c
commit
a5a061335e
4 changed files with 26 additions and 4 deletions
|
@ -508,6 +508,7 @@ class DomainOrgNameAddressForm(forms.ModelForm):
|
||||||
return old_value == new_value
|
return old_value == new_value
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Will be refined in #2352
|
||||||
class DomainSuborganizationForm(forms.ModelForm):
|
class DomainSuborganizationForm(forms.ModelForm):
|
||||||
"""Form for updating the suborganization"""
|
"""Form for updating the suborganization"""
|
||||||
|
|
||||||
|
@ -536,6 +537,9 @@ 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"
|
||||||
|
|
||||||
|
# TODO: Remove in #2352
|
||||||
|
DomainHelper.disable_field(self.fields['sub_organization'], disable_required=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DomainDnssecForm(forms.Form):
|
class DomainDnssecForm(forms.Form):
|
||||||
|
|
|
@ -15,11 +15,16 @@
|
||||||
If you believe there is an error please contact <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>.
|
If you believe there is an error please contact <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% include "includes/required_fields.html" %}
|
{% if suborganization_is_editable %}
|
||||||
|
{% include "includes/required_fields.html" %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<form class="usa-form usa-form--large" method="post" novalidate id="form-container">
|
<form class="usa-form usa-form--large" method="post" novalidate id="form-container">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% input_with_errors form.sub_organization %}
|
{% input_with_errors form.sub_organization %}
|
||||||
<button type="submit" class="usa-button">Save</button>
|
{% if suborganization_is_editable %}
|
||||||
|
<button type="submit" class="usa-button">Save</button>
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -67,8 +67,10 @@ error messages, if necessary.
|
||||||
{% include "includes/readonly_input.html" %}
|
{% include "includes/readonly_input.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# this is the input field, itself #}
|
{# this is the input field, itself. Toggleable because of the show_readonly flag. #}
|
||||||
{% include widget.template_name %}
|
{% if not remove_input_field %}
|
||||||
|
{% include widget.template_name %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if append_gov %}
|
{% if append_gov %}
|
||||||
<span class="padding-top-05 padding-left-2px">.gov </span>
|
<span class="padding-top-05 padding-left-2px">.gov </span>
|
||||||
|
|
|
@ -26,6 +26,7 @@ from registrar.models import (
|
||||||
UserDomainRole,
|
UserDomainRole,
|
||||||
)
|
)
|
||||||
from registrar.models.public_contact import PublicContact
|
from registrar.models.public_contact import PublicContact
|
||||||
|
from registrar.models.utility.domain_helper import DomainHelper
|
||||||
from registrar.utility.enums import DefaultEmail
|
from registrar.utility.enums import DefaultEmail
|
||||||
from registrar.utility.errors import (
|
from registrar.utility.errors import (
|
||||||
GenericError,
|
GenericError,
|
||||||
|
@ -222,6 +223,7 @@ class DomainOrgNameAddressView(DomainFormBaseView):
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Edit will be added in #2352
|
||||||
class DomainSubOrganizationView(DomainFormBaseView):
|
class DomainSubOrganizationView(DomainFormBaseView):
|
||||||
"""Suborganization view"""
|
"""Suborganization view"""
|
||||||
|
|
||||||
|
@ -249,6 +251,15 @@ class DomainSubOrganizationView(DomainFormBaseView):
|
||||||
# superclass has the redirect
|
# superclass has the redirect
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
"""Adds custom context."""
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
# TODO: Switch to True #2352
|
||||||
|
suborganization_is_editable = False
|
||||||
|
context["suborganization_is_editable"] = suborganization_is_editable
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class DomainSeniorOfficialView(DomainFormBaseView):
|
class DomainSeniorOfficialView(DomainFormBaseView):
|
||||||
"""Domain senior official editing view."""
|
"""Domain senior official editing view."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue