Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self Many2Many Relationship duplicate key value violates unique constraint #13

Open
simone opened this issue Jul 2, 2012 · 0 comments

Comments

@simone
Copy link
Owner

simone commented Jul 2, 2012

In the testapp example, Author.friends doesn't permit to relate an author with himself.

Classic Author (with no CFP) works.

Observation:
MayToMany in django assume that symmetrical=True,
I think there is an check in the django code for this unique constraint to evolve for the composite keys.

this is the exception:

IntegrityError at /admin/sample/author/'Simone'-'33'/
duplicate key value violates unique constraint "sample_author_friends_from_author_name_from_author_age_to_a_key"
DETAIL: Key (from_author_name, from_author_age, to_author_name, to_author_age)=(Simone, 33, Simone, 33) already exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant