Don’t attempt to store domain as empty string

When there is a uniqueness constraint on a DB column you can still have
multiple null values.

You can’t have multiple empty string values.

We are trying to save the domain as empty string when creating or
updating a new branding. This means that it’s currently not possible to
create or update a branding with no domain, because the uniqueness
constraint is violated.
This commit is contained in:
Chris Hill-Scott
2018-09-13 15:35:39 +01:00
parent a9962d2a18
commit c800312281
2 changed files with 11 additions and 3 deletions

View File

@@ -728,6 +728,8 @@ class GovernmentDomainField(StringField):
]
def post_validate(self, form, validation_stopped):
if self.data == '':
self.data = None
if self.data and not self.errors:
self.data = AgreementInfo(self.data).canonical_domain