Hey,

The player belongs to a club. So in the player model you should have

player_club = models.ForeignKey(Club)

then remove the foreign key in the Club model. Also, notice casing - your
variable names should be lowercase and if it's more than one word, join it
with underscores. It's Python convention.


On Fri, Jun 14, 2013 at 2:51 PM, Hélio Miranda <helio...@gmail.com> wrote:

> After reading a bit what I did was the following:
> Código (Python):
> from django.db import models
> class Player(models.Model):
>     #idPlayer = models.AutoField(primary_key=True)
>     PlayerName = models.CharField(max_length=200)
>     PlayerAge = models.CharField(max_length=200)
>     #Clubs = models.ManyToManyField('Club', through='PlayerClub', null =
> True, blank = True)
>
> class Club(models.Model):
>     #idClub = models.AutoField(primary_key=True)
>     ClubName = models.CharField(max_length=200)
>     Players = models.ManyToManyField(Player, through='PlayerClub')
>
> class PlayerClub(models.Model):
>     Player = models.ForeignKey(Player)
>     Club = models.ForeignKey(Club)
>
> But for example when I am inserting the player wanted to say that club he
> belongs, as is how do I right?
> What I wanted to do was enter the club, and when I select the player to
> enter the club he belongs.
> When to see the player, the data comes from the player and the club that
> belongs to consult a club and when I say that players belong to this club.
> I'm going the right way?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Regards,
Sithu Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to