refactor: Simplify User person test

This commit is contained in:
James Graham
2020-04-02 18:40:11 +01:00
parent eea4342455
commit 63e06d812d

View File

@@ -1,5 +1,3 @@
import typing
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
from django.db import models from django.db import models
@@ -28,12 +26,7 @@ class User(AbstractUser):
""" """
Does this user have a linked :class:`Person` record? Does this user have a linked :class:`Person` record?
""" """
try: return hasattr(self, 'person')
person = self.person
return True
except AttributeError:
return False
class Organisation(models.Model): class Organisation(models.Model):