Refactor model layout

This commit is contained in:
Seamus Johnston 2022-11-10 08:26:06 -06:00
parent 349659be90
commit 8b8ade428b
No known key found for this signature in database
GPG key ID: 2F21225985069105
11 changed files with 522 additions and 462 deletions

View file

@ -0,0 +1,29 @@
from django.db import models
from .utility.time_stamped_model import TimeStampedModel
from .utility.address_model import AddressModel
from .contact import Contact
from .user import User
class UserProfile(TimeStampedModel, Contact, AddressModel):
"""User information, unrelated to their login/auth details."""
user = models.OneToOneField(
User,
null=True,
blank=True,
on_delete=models.CASCADE,
)
display_name = models.TextField()
def __str__(self):
# use info stored in User rather than Contact,
# because Contact is user-editable while User
# pulls from identity-verified Login.gov
try:
return str(self.user)
except Exception:
return "Orphaned account"