Add string representations for profiles

This commit is contained in:
Kumi 2020-06-22 08:33:43 +02:00
parent b68475f813
commit 49e43ad24d

View file

@ -45,6 +45,9 @@ class AdminProfile(Profile):
else: else:
self.permission_string = ",".join(permissions) self.permission_string = ",".join(permissions)
def __str__(self):
return self.get_internal_name
class ClientProfile(Profile): class ClientProfile(Profile):
company = LongCharField(null=True, blank=True) company = LongCharField(null=True, blank=True)
address1 = LongCharField() address1 = LongCharField()
@ -61,3 +64,6 @@ class ClientProfile(Profile):
marketing_opt_in = DateTimeField(null=True) marketing_opt_in = DateTimeField(null=True)
pgp_key = TextField(null=True) pgp_key = TextField(null=True)
main_client = ForeignKey("self", null=True, on_delete=SET_DEFAULT, default=None) main_client = ForeignKey("self", null=True, on_delete=SET_DEFAULT, default=None)
def __str__(self):
return f"{self.company if self.company else ''}{' - ' if self.company and self.user.get_full_name else ''}{self.user.get_full_name if self.user.get_full_name else ''}"