Merge pull request #2985 from matmair/dead-code-owner

remove duplicate code
This commit is contained in:
Oliver 2022-05-15 21:51:57 +10:00 committed by GitHub
commit 9c1e266628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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