Skip to content

Commit

Permalink
Replace name property with full_name field
Browse files Browse the repository at this point in the history
  • Loading branch information
jwang44 committed Sep 20, 2022
1 parent 68a6129 commit af53eaf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ def handle(self, *args, **options):
# set all users to be non-indexer first
# those listed as indexers on old Cantus will have this adjusted to True
user.is_indexer = False
# do not use the existing "name" property,
# because for some reason, the first/last names can have trailing spaces
# TODO: populate the full_name field and remove the "name" property
if user.first_name or user.last_name:
user.full_name = f"{user.first_name.strip()} {user.last_name.strip()}"
else:
Expand Down
9 changes: 1 addition & 8 deletions django/cantusdb_project/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,9 @@ class User(AbstractUser):

objects = CustomUserManager()

@property
def name(self):
def __str__(self):
if self.full_name:
return self.full_name
elif self.first_name and self.last_name:
return f'{self.first_name} {self.last_name}'

def __str__(self):
if self.name:
return self.name
else:
return self.email

Expand Down

0 comments on commit af53eaf

Please sign in to comment.