I have some custom permissions that I would like to give to about half a dozen different classes. If I did them individually they might look like this:
MyModel(models.Model):
...
Meta:
permissions = (('view_mymodel', 'View Mymodel'),)
...
That's all good and well, but following a DRY principle, I thought I would simply create an abstract class to inherit from. I thought it would look like this:
MyAbstractModel(models.Model):
...
Meta:
permissions = (('view_%s' % self.__class__, 'View %s' % self.__class__))
...
MyModel(MyAbstractModel):
...
The problem is that, as far as I can tell, there is no way to access the class name from inside the Meta class. I can't find a way to make the above work. I'm very much looking for suggestions.