Would this hack for per-object permissions in django work?
- by Edward
According to the documentation, a class can have the meta option permissions, described as such:
Options.permissions
Extra permissions to enter into the permissions table when creating this object. Add, delete and change permissions are automatically created for each object that has admin set. This example specifies an extra permission, can_deliver_pizzas:
permissions = (("can_deliver_pizzas", "Can deliver pizzas"),)
This is a list or tuple of 2-tuples in the format (permission_code, human_readable_permission_name).
Would it be possible to define permissions at run time by:
permissions = (("can_access_%s" % self.pk, /
"Has access to object %s of type %s" % (self.pk,self.__name__)),)
?