Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2286 closed defect (invalid)

Validation error with syncdb

Reported by: Chris Beaven Owned by: Adrian Holovaty
Component: Core (Management commands) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I have an Email model linked to a Contact model (contact=ForeignKey(Contact) in the Email model).

The Contact model has an EmailField named email.

Syncdb is complaining that:

Reverse query name for field 'contact' clashes with field ''."

If my understanding is correct, the reverse query name will be email_set, not email so this shouldn't be a clash, should it? My work around at the moment is to actually set reverse_query='email_set', syncdb stops complaining but this is (in my understanding) the default reverse query name in this case anyway so it's a bit weird.

(Just to be clear, the Email model is an actual email and the email field is an email address so they do serve seperate purposes)

Change History (2)

comment:1 Changed 10 years ago by Malcolm Tredinnick

Resolution: invalid
Status: newclosed

This error message is correct. The email_set attribute you are thinking of is called an "accessor" inside Django and is used for looking up the reverse relation as an attribute on an instance. The reverse query name is used in filter statements for example. See By default, the lowercase name of the related model is used, but in cases like yours, this won't work.

comment:2 Changed 10 years ago by Chris Beaven

Thanks for that clarification

Note: See TracTickets for help on using tickets.
Back to Top