Django

Code

Ticket #2652 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

[patch] [per-object-permissions] changing perms fails if another app has model called 'user' or 'group'

Reported by: mattimustang@gmail.com Assigned to: clong
Milestone: Component: django.contrib.admin
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

My application has a model called Group so editing row level perms fails because the ContentType? lookup is not specific enough.

Patch below fixes it.

Index: django/contrib/admin/row_level_perm_manipulator.py
===================================================================
--- django/contrib/admin/row_level_perm_manipulator.py  (revision 3712)
+++ django/contrib/admin/row_level_perm_manipulator.py  (working copy)
@@ -144,7 +144,7 @@
         
     def returnObject(data):
         data = data.split('-')
-        ct = ContentType.objects.get(model__exact=data[0])
+        ct = ContentType.objects.get(app_label='auth', model__exact=data[0])
         obj = ct.get_object_for_this_type(pk=data[1])
         return obj
 
@@ -157,4 +157,4 @@
     returnKey = staticmethod(returnKey)
         
         
-        
\ No newline at end of file
+        

Attachments

Change History

09/04/06 11:40:03 changed by clong

  • owner changed from adrian to clong.

09/04/06 11:59:09 changed by clong

  • status changed from new to closed.
  • resolution set to fixed.

(In [3716]) [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 /)


Add/Change #2652 ([patch] [per-object-permissions] changing perms fails if another app has model called 'user' or 'group')




Change Properties
Action