remove duplicate code

we are already checking this stuff from line 640
This commit is contained in:
Matthias 2022-05-13 01:27:40 +02:00
parent c2dd8afea6
commit 3712daca55
No known key found for this signature in database
GPG Key ID: AB6D0E6C4CB65093

View File

@ -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