remove security email from domainInfo, create migration, simplify form_valid set security email

This commit is contained in:
rachidatecs 2023-05-17 13:39:46 -04:00
parent c01a0276e5
commit 6a86a53d04
No known key found for this signature in database
GPG key ID: 3CEBBFA7325E5525
3 changed files with 20 additions and 14 deletions

View file

@ -0,0 +1,16 @@
# Generated by Django 4.2 on 2023-05-17 17:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("registrar", "0019_alter_domainapplication_organization_type"),
]
operations = [
migrations.RemoveField(
model_name="domaininformation",
name="security_email",
),
]

View file

@ -200,12 +200,6 @@ class DomainInformation(TimeStampedModel):
blank=True,
help_text="Acknowledged .gov acceptable use policy",
)
security_email = models.EmailField(
max_length=320,
null=True,
blank=True,
help_text="Security email for public use",
)
def __str__(self):
try:

View file

@ -90,7 +90,7 @@ class DomainNameserversView(DomainPermission, FormMixin, DetailView):
domain.set_nameservers(nameservers)
messages.success(
self.request, "The name servers for this domain have been updated"
self.request, "The name servers for this domain have been updated."
)
# superclass has the redirect
return super().form_valid(formset)
@ -129,17 +129,13 @@ class DomainSecurityEmailView(DomainPermission, FormMixin, DetailView):
def form_valid(self, form):
"""The form is valid, call setter in model."""
# Set the security email from the from
try:
new_email = form.cleaned_data["security_email"]
except KeyError:
# no server information in this field, skip it
pass
# Set the security email from the form
new_email = form.cleaned_data["security_email"]
domain = self.get_object()
domain.set_security_email(new_email)
messages.success(
self.request, "The security email for this domain have been updated"
self.request, "The security email for this domain have been updated."
)
# superclass has the redirect
return redirect(self.get_success_url())