Skip to content

Commit

Permalink
[per-object-permissions] Fixes #2652, modified the form field to incl…
Browse files Browse the repository at this point in the history
…ude the app label in the select field (the elements of which are now separated by a /)

git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@3716 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
Christopher Long committed Sep 4, 2006
1 parent ea2a514 commit aef0582
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions django/contrib/admin/row_level_perm_manipulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ def render(self, data):
return '\n'.join(output)

def returnObject(data):
data = data.split('-')
ct = ContentType.objects.get(model__exact=data[0])
obj = ct.get_object_for_this_type(pk=data[1])
data = data.split('/')
ct = ContentType.objects.get(app_label__exact=data[0], model__exact=data[1])
obj = ct.get_object_for_this_type(pk=data[2])
return obj

def returnKey(obj, ct=None):
if not ct:
ct = ContentType.objects.get_for_model(obj.__class__)
return ct.model+"-"+str(obj.id)
return ct.app_label+"/"+ct.model+"/"+str(obj.id)

returnObject = staticmethod(returnObject)
returnKey = staticmethod(returnKey)
Expand Down

0 comments on commit aef0582

Please sign in to comment.