Fix member model no user __str__ history bug

This commit is contained in:
Tanner Collin 2023-01-19 18:07:31 +00:00
parent 8dcc61817f
commit c4185b15ca

View File

@ -63,7 +63,7 @@ class Member(models.Model):
MY_FIELDS = ['user', 'preferred_name', 'last_name', 'status'] MY_FIELDS = ['user', 'preferred_name', 'last_name', 'status']
def __str__(self): def __str__(self):
return self.user.username return getattr(self.user, 'username', 'None')
class Transaction(models.Model): class Transaction(models.Model):
user = models.ForeignKey(User, related_name='transactions', blank=True, null=True, on_delete=models.SET_NULL) user = models.ForeignKey(User, related_name='transactions', blank=True, null=True, on_delete=models.SET_NULL)