Author: clong
Date: 2006-09-04 11:59:09 -0500 (Mon, 04 Sep 2006)
New Revision: 3716
Modified:
django/branches/per-object-permissions/django/contrib/admin/row_level_perm_manipulator.py
Log:
[per-object-permissions] Fixes #2652, modified the form field to include the
app label in the select field (the elements of which are now separated by a /)
Modified:
django/branches/per-object-permissions/django/contrib/admin/row_level_perm_manipulator.py
===================================================================
---
django/branches/per-object-permissions/django/contrib/admin/row_level_perm_manipulator.py
2006-09-04 14:22:30 UTC (rev 3715)
+++
django/branches/per-object-permissions/django/contrib/admin/row_level_perm_manipulator.py
2006-09-04 16:59:09 UTC (rev 3716)
@@ -143,15 +143,15 @@
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)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
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-updates
-~----------~----~----~----~------~----~------~--~---