mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
remove duplicate code
we are already checking this stuff from line 640
This commit is contained in:
parent
c2dd8afea6
commit
3712daca55
@ -648,36 +648,6 @@ class Owner(models.Model):
|
|||||||
owner_type=content_type_id)
|
owner_type=content_type_id)
|
||||||
except Owner.DoesNotExist:
|
except Owner.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
# Check whether user_or_group is a Group instance
|
|
||||||
try:
|
|
||||||
group = Group.objects.get(pk=user_or_group.id)
|
|
||||||
except Group.DoesNotExist:
|
|
||||||
group = None
|
|
||||||
|
|
||||||
if group:
|
|
||||||
try:
|
|
||||||
owner = Owner.objects.get(owner_id=user_or_group.id,
|
|
||||||
owner_type=content_type_id_list[0])
|
|
||||||
except Owner.DoesNotExist:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return owner
|
|
||||||
|
|
||||||
# Check whether user_or_group is a User instance
|
|
||||||
try:
|
|
||||||
user = user_model.objects.get(pk=user_or_group.id)
|
|
||||||
except user_model.DoesNotExist:
|
|
||||||
user = None
|
|
||||||
|
|
||||||
if user:
|
|
||||||
try:
|
|
||||||
owner = Owner.objects.get(owner_id=user_or_group.id,
|
|
||||||
owner_type=content_type_id_list[1])
|
|
||||||
except Owner.DoesNotExist:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return owner
|
|
||||||
|
|
||||||
return owner
|
return owner
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user