I'm not 100% sure if this is just a terrible design on my part, or I'm not thinking clearly.
I'm utilising the
Group model with a m2m relationship to
allowed_groups on my
class Category(models.Model): """Forums are separated into Categories. A Category may hold many Forums""" name = models.CharField(max_length=80) position = models.IntegerField(blank=True, default=0) allowed_groups = models.ManyToManyField( Group, blank=True, null=True, help_text="Select what usergroups are able to see this forum.", related_name='forum_categories', ) class Meta: ordering = ['position'] verbose_name = 'Category' verbose_name_plural = 'Categories' def __unicode__(self): return u'%s' % self.name
I originally attempted this with a m2m to the
User model, however I quickly came to realise that it would become very tedious assigning what
Category instances a
User would be able to see every time a new
What I'm trying to achieve, is get the
Category instances that a
User should be able to see defined by what
Group they are in. The problem being, that they could potentially be within more than 1
Group at any given time.
I've tried to utilise the reverse
forum_categories however if they are in more than one group it returns duplicates of