On Sat, Oct 25, 2008 at 11:36 AM, Florencio Cano
<[EMAIL PROTECTED]>wrote:

>
> You are saying that a Pupil is a Team and a Team is a Pupil with that
> OneToOneField. In the Team you are saying one Pupil belongs to many
> Teams and a Team have many Pupils that seems ok but the OneToOneField
> seems wrong.
>

Yes, that seemed wrong to me as well.  If a Pupil can be on one Team and a
Team is made up of many Pupils than Pupil should have a ForeignKey to Team,
that's it.  No OneToOne or ManyToMany.

Similarly the ManyToMany relation to Result in Pupil confuses me.  I'd think
a given Result would be associated with a Pupil (a Pupil submits a Result?),
so Result would have a ForeignKey to the Pupil who submitted it.  There is
then no need for any reference to Result in Pupil, the reverse relation is
automatically created.

It's hard for me to say what's wrong, exactly, with the models as you have
them set up because I am missing the basic overall description of the
entities you wan to track and their relationships to each other.  From the
model definitions alone (even with the brief comments) I'm not understanding
what things like Result, Table, and Point are supposed to be.  I'm thinking
you should have ForeignKeys where you have ManyToManys in several instances,
but I can't say that with any confidence because I'm missing the overall
structure.

So I'd advise taking a step back and describing in words, not code, what the
overall problem you are trying to solve is.  Identify what things you think
you need to track and what the relationships are between them, and then
people can advise on drawing up models.

Also, you might want to read through the docs some more on relations. I have
a feeling you're complicating this unnecessarily and using a lot of
ManyToManys where you really should be using ForeignKeys -- you've got no
ForeignKeys, and I find that odd.  It's a very common sort of relationship
and I'd think you'd have some.

Karen

--~--~---------~--~----~------------~-------~--~----~
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