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.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/mp_2buiwJ_cJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.