On Thu, 2010-01-14 at 03:25 -0800, ifcho wrote:
> Hi,
> 
> I'm very new to Django, and I'm sorry if the question is really dumb.

Kind of a dumb question... See why:

> So I have a database model for a drivers (rally car driver), and I
> have database model for the results. As you know a rally car team is
> of two - a driver and co-driver. And so I have:
> class EntryList(models.Model):
> .....
>     the_driver = models.ForeignKey(Drivers)
>     the_co_driver = models.ForeignKey(Drivers)
> .....
> here is where I get the following error:
> manage.py validate
> Error: One or more models did not validate:
> mysite.entrylist: Accessor for field 'the_driver' clashes with related
> field 'Drivers.entrylist_set'. Add a related_name argument to the
> definition for 'the_driver'.

Did you read what error says?

> mysite.entrylist: Accessor for field 'the_co_driver' clashes with
> related field 'Drivers.entrylist_set'. Add a related_name argument to
> the definition for 'the_co_driver'.

Again, did you actually read what it said again?

> after commenting the_driver, or the_co_driver, the error is gone.

And if you didn't guessed yet, you have to still add "related_name"
argument for field definition. What it means can be found at django
documentation:

<http://docs.djangoproject.com/en/1.1/ref/models/fields/#django.db.models.ForeignKey.related_name>

-- 

Jani Tiainen


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


Reply via email to