Repository navigation
[Company] Allow duplicate names - Unique name/email pair - #1043
Conversation
|
Now that the "name" field does not have to be unique, but the email does, there still could be a situation where multiple company objects exist with the same name and a blank email. So, I would suggest that we add a requirement that if the email is empty, then the name must be unique. It may be as simple as adding: class Meta:
unique_together = [
('name', 'email'),
](but this requires testing) |
|
Thanks @SchrodingersGat I'll take another shot with this in mind. Seems like the better way is to create a |
|
@SchrodingersGat This PR is ready for review, I did testing with the migration on my database and validation on the modal form, everything looks good on my side. |
…ique_email_company
|
@eeintech I'm pretty happy with this on my side, I don't see any issues with this as it stands. Thanks for addressing the issue 👍 |
Fixes #1040.
namefield unique constraint was removedemailfield null constraint was set toTrue(convert empty string toNullvalue)Companyemailfield unique constraint was set toTrue(check for uniqueness)emailfield empty string value toNullvalueUniqueConstrainton name/email pair (instead of unique constraint on email only)