Read the message a little closer, it tells you what to do.. each
ForeignKey field needs a related_name to distinguish it from the
other.

On Feb 13, 10:33 am, "Sairam Krishnamurthy" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I have a table structure like this.
>
> class Componentdependencies(models.Model):
>     componentVersionID = models.ForeignKey(Componentversions)
>     depComponentVersionID = models.ForeignKey(Componentversions)
>     useFlagID = models.ForeignKey(Useflags, db_column='useFlagID')
>     class Meta:
>         db_table = 'ComponentDependencies'
>
> The two fields componentVersionID and depComponentVersionID refer foreign
> keys referring to another table 'Componentversions'. The class above is an
> entry from models.py. When to try to create the tables using syncdb it gives
> me the following error.
>
> Error: Couldn't install apps, because there were errors in one or more
> models:
> cdb.componentdependencies: Accessor for field 'componentVersionID' clashes
> with related field 'Componentversions.componentdependencies_set'. Add a
> related_name argument to the definition for 'componentVersionID'.
> cdb.componentdependencies: Accessor for field 'depComponentVersionID'
> clashes with related field 'Componentversions.componentdependencies_set'.
> Add a related_name argument to the definition for 'depComponentVersionID'.
>
> It is due to two fields of the same table declared as foreign keys of the
> same table. This is very common usage in any database. Can somebody help me
> how to resolve this problem?
>
> Thanks in advance,
>
> Sairam K
--~--~---------~--~----~------------~-------~--~----~
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