Django m2m adding field in the secondary table
Posted
by dana
on Stack Overflow
See other posts from Stack Overflow
or by dana
Published on 2010-06-16T13:28:12Z
Indexed on
2010/06/16
13:32 UTC
Read the original article
Hit count: 180
I have a model in wich i'm using m2m Django ORM feature, in order to create an aditional table to hold my 'classrom members'. My problem is: the membership to a classroom must be accepted by the invited one, so i need a boolean field :1=accepted, 0=refused/unseen yet. How can i include this boolean variable in the aditionally generated classroom_membership (and NOT in the primary created Classroom table)?
class Classroom(models.Model):
user = models.ForeignKey(User, related_name = 'classroom_creator')
classname = models.CharField(max_length=140, unique = True)
date = models.DateTimeField(auto_now=True)
open_class = models.BooleanField(default=True)
#domain = models.EnumField()
members = models.ManyToManyField(User,related_name="list of invited members")
Thanks in advance!!
© Stack Overflow or respective owner