mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-17 23:14:11 +02:00
Refactor model layout
This commit is contained in:
parent
349659be90
commit
8b8ade428b
11 changed files with 522 additions and 462 deletions
29
src/registrar/models/user_profile.py
Normal file
29
src/registrar/models/user_profile.py
Normal 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"
|
Loading…
Add table
Add a link
Reference in a new issue