lukaszb/django-guardian — pull request #83 by culebron (2012-09-07 09:55:20+00:00)
Title: @owned_by

Hi,
this is a decorator to add to model classes:

@owned_by('shop__user')
class Item(models.Model)
shop = ForeignKey(Shop)
...

When Item instance is created and saved, the decorator will assign to the user specified in the field lookup ('shop__user') all permissions on the instance.

If you need only specific pemissions, do this:

@owned_by('shop__user', ('change_item', 'view_item'))
...