mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
[per-object-permissions] Fixes bug described in ticket #2749
[per-object-permissions] Fixes the add manipulator so it does not assume the pk attribute is "id" git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@3767 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a2fbd5f14c
commit
20ca1751dc
@ -77,7 +77,8 @@ class AddRLPManipulator(ChangeRLPManipulator):
|
||||
#Check that the new row level perms are unique
|
||||
field_name_list = ('owner_ct', 'owner_id', 'model_ct', 'model_id', 'permission')
|
||||
field_data = ct.id
|
||||
all_data = {'owner_id':owner.id, 'model_ct_id':self.ct.id, 'model_id':self.obj_instance.id, 'permission_id':perm.id}
|
||||
model_id = self.obj_instance._get_pk_val()
|
||||
all_data = {'owner_id':owner.id, 'model_ct_id':self.ct.id, 'model_id':model_id, 'permission_id':perm.id}
|
||||
manipulators.manipulator_validator_unique_together(field_name_list, self.opts, self, field_data, all_data)
|
||||
|
||||
rlp = RowLevelPermission.objects.create_row_level_permission(self.obj_instance, owner, perm, negative=new_data['negative'])
|
||||
|
@ -117,7 +117,7 @@ class GenericRelation(RelatedField, Field):
|
||||
return self.object_id_field_name
|
||||
|
||||
def m2m_reverse_name(self):
|
||||
return self.model._meta.pk.attname
|
||||
return self.object_id_field_name
|
||||
|
||||
def contribute_to_class(self, cls, name):
|
||||
super(GenericRelation, self).contribute_to_class(cls, name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user