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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.