mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2985 from matmair/dead-code-owner
remove duplicate code
This commit is contained in:
commit
9c1e266628
@ -648,36 +648,6 @@ class Owner(models.Model):
|
||||
owner_type=content_type_id)
|
||||
except Owner.DoesNotExist:
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user