From 2ab62c1ee5ce221d08b3d3019ba2298a695592be Mon Sep 17 00:00:00 2001 From: clr-li <111320104+clr-li@users.noreply.github.com> Date: Mon, 30 Oct 2023 21:08:44 -0700 Subject: [PATCH] Added verbose names --- app_users/admin.py | 24 ++++-------------------- app_users/models.py | 10 ++++++---- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/app_users/admin.py b/app_users/admin.py index fe539c761..5a90c302c 100644 --- a/app_users/admin.py +++ b/app_users/admin.py @@ -12,12 +12,12 @@ class AppUserAdmin(admin.ModelAdmin): list_display = [ "uid", - "name", + "display_name", "email", "phone_number", - "bal", - "paid", - "created", + "balance", + "is_paying", + "created_at", ] search_fields = [ "uid", @@ -51,22 +51,6 @@ def user_runs(self, user: models.AppUser): show_add=False, ) - @admin.display(description="Name") - def name(self, user: models.AppUser): - return user.display_name - - @admin.display(description="Paid") - def paid(self, user: models.AppUser): - return user.is_paying - - @admin.display(description="Bal") - def bal(self, user: models.AppUser): - return user.balance - - @admin.display(description="Created") - def created(self, user: models.AppUser): - return user.created_at - def open_in_firebase(self, user: models.AppUser): path = f"users/{user.uid}" return open_in_new_tab( diff --git a/app_users/models.py b/app_users/models.py index 6a72eecab..5e373f414 100644 --- a/app_users/models.py +++ b/app_users/models.py @@ -78,18 +78,20 @@ def get_or_create_firebase_user_by_email(email: str) -> tuple[auth.UserRecord, b class AppUser(models.Model): uid = models.CharField(max_length=255, unique=True) - display_name = models.TextField(default="", blank=True) + display_name = models.TextField("name", blank=True) email = models.EmailField(null=True, blank=True) phone_number = PhoneNumberField(null=True, blank=True) - balance = models.IntegerField() + balance = models.IntegerField("bal") is_anonymous = models.BooleanField() is_disabled = models.BooleanField(default=False) photo_url = CustomURLField(default="", blank=True) stripe_customer_id = models.CharField(max_length=255, default="", blank=True) - is_paying = models.BooleanField(default=False) + is_paying = models.BooleanField("paid", default=False) - created_at = models.DateTimeField(editable=False, blank=True, default=timezone.now) + created_at = models.DateTimeField( + "created", editable=False, blank=True, default=timezone.now + ) upgraded_from_anonymous_at = models.DateTimeField(null=True, blank=True) disable_safety_checker = models.BooleanField(default=False)