Hello everyone I just started with django and was wondering how to do
the following behaivor in my models:

class Game(models.Model)
  characters_count = models.IntegerField(default=1) #basically i set
to a choice of 1-3

class Match(models.Model)
 video=models.ForeignKey(Game)
 p1char1 = models.ForeignKey(Character)
 p2char1 = models.ForeignKey(Character)
 p1char2 = models.ForeignKey(Character)
 p2char2 = models.ForeignKey(Character)
 p1char3 = models.ForeignKey(Character)
 p2char3 = models.ForeignKey(Character)
video contains the instance game which Match relies on.

I need to create a constraint that the Character selected is from the
given game and that the number of characters each player selects is
limited by game as well.

Should I perform this on the Save method? or can I set these
constraints some other way so the forms will be generated by the
models accordingly without doing it manually.

Will the limitation on the characters (by the game) can be done on the
definition of the model?

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