Hi,

(I'm trying to create test cases for ticket #2536 and this is something I
hadn't noted until now):

Say I have a models.py file almost identical to the modeltest/example #24:

from django.db import models

class Parent( models.Model ):
    name = models.CharField(maxlength=100)
    child = models.ForeignKey("Child", null=True)

class Child( models.Model ):
    name = models.CharField(maxlength=100)
    parent = models.ForeignKey(Parent)

That is, two mutually referencing models via FKs. But:
* No related_name option has been used in the FK definitions and
* The Parent model has a "child" FK to the Child model

So, the declared Parent->Child relationship gets named "child", and
it's reverse relationship get named "parent_set". Similarly the
declared
Child->Parent relationship is "parent" and it reverse is "child_set".

Now the question :): Why does Django model validation reports name clash
errors and suggests to use related_name when clearly there are not
such clashes?:

ticket2536.parent: Reverse query name for field 'child' clashes with field
'Child.parent'. Add a related_name argument to the definition for 'child'.

ticket2536.child: Reverse query name for field 'parent' clashes with field
'Parent.child'. Add a related_name argument to the definition for 'parent'.

2 errors found.

TIA for any enlightenment.

-- 
 Ramiro Morales

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to