Would this hack for per-object permissions in django work?

Posted by Edward on Stack Overflow See other posts from Stack Overflow or by Edward
Published on 2010-03-13T07:20:54Z Indexed on 2010/03/13 7:25 UTC
Read the original article Hit count: 316

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__)),)

?

© Stack Overflow or respective owner

Related posts about django

Related posts about python