mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user