I am at a crossroad actually in my Django 1.5 project and need some community advice before turning right or left.
Here are my models Article Model
class Article(models.Model):
title = models.CharField(max_length=1000, verbose_name="Titre")
zone = models.ForeignKey('Zone', verbose_name=u"Area")
and my Zone Model
class Zone(models.Model):
name = models.CharField(max_length=50, unique=True)
slug = models.CharField(max_length=50, unique=True)
def __unicode__(self):
return unicode(self.name)
class Meta:
ordering = ['name']
Each article is in a geographic "zone".
All my users depends also on the same "zone" and can edit/add/delete article that belong to the same "zone" as user does.
Path #1 :
I must work with django-guardian. It will pay on the long run or overkill ?
Path #2 :
I only need to set ForeignKey CustomUser Model <-> Zone Model <-> Article Model. Then I check for each view if CustomUser.Zone == Article.Zone before proceeding.
Path #3 :
Your call.