[Answer]-Django IntegrityError error

1đź‘Ť

âś…

You’ve excluded firm from the form, and don’t add it until after validation, so there’s no way the form can validate that the combination of firm and name is unique. You’ll need to pass it int the form some other way and check explicitly in the form’s clean method that there is no existing instance with that combination.

0đź‘Ť

This definition means “Account with this Firm and Name already exists.” You are receiving the same error in both cases,

unique_together = (
    'firm', 'name'
)

Exception Value: columns firm_id, name are not unique, that means the same as the admin panel error.

👤lapinkoira

Leave a comment