On Oct 25, 4:09 pm, AdamC <[EMAIL PROTECTED]> wrote:
> Thanks Manuel - even if I take that out, I'm still getting the error:
>
> Error: One or more models did not validate:
> tables.pupil: Reverse query name for m2m field 'result' clashes with
> m2m field 'Result.pupil'. Add a related_name argument to the
> definition for 'result'.
> tables.team: Reverse query name for m2m field 'pupils' clashes with
> field 'Pupil.team'. Add a related_name argument to the definition for
> 'pupils'.
> tables.result: Reverse query name for m2m field 'pupil' clashes with
> m2m field 'Pupil.result'. Add a related_name argument to the
> definition for 'pupil'.
> tables.table: "table": "choices" should be a sequence of two-tuples.
> tables.table: "table": "choices" should be a sequence of two-tuples.
> tables.table: "table": "choices" should be a sequence of two-tuples.
>
> Adam
> --
> You back your data up on the same planet?http://www.monkeez.org
> PGP key: 0x7111B833


Well, the error messages are quite clear. You've got problems both
with your relationships, and also with the choices on the 'table'
field.

The relationships problem is because you've defined both ends of the
ManyToManyFields. Don't do that. As the documentation explains, Django
automatically creates a 'reverse' relation for you, so that's why
you're getting the conflicts. Pick one end of the relationship and put
the ManyToManyField there.

I'm confused about the relationship between Pupil and Team. On one end
of that relationship, you've got a ManyToMany, implying that each
pupil can be a member of many teams, and vice versa. On the other end,
you've got a OneToOne, implying that each pupil makes up a team by
himself, which is obviously wrong and conflicts with the ManyToMany. I
suspect what you actually mean here is a standard ForeignKey from
pupil to team - ie each team is composed of mulitple pupils, but a
pupil can only be a member of one team.

The choices problem is because your TABLE_CHOICES is only one-
dimensional. Again, as the documentation states, you need to have a
two-dimensional tuple - the first value is what is stored in the DB,
and the second is what is displayed to the user. Since you're not
concerned about a display value, you can just duplicate the db value -
but you do need both values. For example:
TABLE_CHOICES = (
   ('2', '2'),
   ('5', '5'),
   ('10', '10),
)

Finally, the relationship between Point and Table is OneToOne - this
isn't causing any validation errors, but I don't think it's what you
want, since it will mean that each table can only have one point.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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