From a6e833b8ed3114a3224644b68008b1f32a3ae15f Mon Sep 17 00:00:00 2001 From: clr-li <111320104+clr-li@users.noreply.github.com> Date: Thu, 26 Oct 2023 01:02:46 -0700 Subject: [PATCH 1/5] Change datetime format to follow Oct 19, 10:47 AM --- app_users/admin.py | 27 ++++++++++++++++++++------- daras_ai_v2/prompt_vars.py | 2 +- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app_users/admin.py b/app_users/admin.py index ebd901ecf..fe539c761 100644 --- a/app_users/admin.py +++ b/app_users/admin.py @@ -12,15 +12,12 @@ class AppUserAdmin(admin.ModelAdmin): list_display = [ "uid", - "display_name", + "name", "email", "phone_number", - "balance", - "is_paying", - "is_anonymous", - "is_disabled", - "created_at", - "upgraded_from_anonymous_at", + "bal", + "paid", + "created", ] search_fields = [ "uid", @@ -54,6 +51,22 @@ 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/daras_ai_v2/prompt_vars.py b/daras_ai_v2/prompt_vars.py index 80f13d906..9d5b4f81d 100644 --- a/daras_ai_v2/prompt_vars.py +++ b/daras_ai_v2/prompt_vars.py @@ -61,6 +61,6 @@ def render_prompt_vars( def context_globals(): return { "datetime": SimpleNamespace( - utcnow=datetime.utcnow().strftime("%B %d, %Y %H:%M:%S %Z"), + utcnow=datetime.utcnow().strftime("%B %d, %H:%M"), ), } From e3d0a5c34a1c6e9d5f4cfe0938bc07b624d5c201 Mon Sep 17 00:00:00 2001 From: clr-li <111320104+clr-li@users.noreply.github.com> Date: Sun, 29 Oct 2023 12:03:50 -0700 Subject: [PATCH 2/5] Fixed time format --- daras_ai_v2/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daras_ai_v2/settings.py b/daras_ai_v2/settings.py index 97cdd3f2e..3c4340420 100644 --- a/daras_ai_v2/settings.py +++ b/daras_ai_v2/settings.py @@ -153,7 +153,7 @@ USE_TZ = True -DATETIME_FORMAT = "N j, D, Y, h:i:s A" +DATETIME_FORMAT = "N j, h:i A" from django.conf.locale.en import formats as es_formats 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 3/5] 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) From c4fe26126ebfea7ef90d5f15fe1ecace286529bf Mon Sep 17 00:00:00 2001 From: clr-li <111320104+clr-li@users.noreply.github.com> Date: Mon, 30 Oct 2023 21:12:42 -0700 Subject: [PATCH 4/5] Fixed context globals --- daras_ai_v2/prompt_vars.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daras_ai_v2/prompt_vars.py b/daras_ai_v2/prompt_vars.py index 9d5b4f81d..80f13d906 100644 --- a/daras_ai_v2/prompt_vars.py +++ b/daras_ai_v2/prompt_vars.py @@ -61,6 +61,6 @@ def render_prompt_vars( def context_globals(): return { "datetime": SimpleNamespace( - utcnow=datetime.utcnow().strftime("%B %d, %H:%M"), + utcnow=datetime.utcnow().strftime("%B %d, %Y %H:%M:%S %Z"), ), } From 92dfe9fe4a79e8b8ab587cc6b83efc93797ed9ca Mon Sep 17 00:00:00 2001 From: clr-li <111320104+clr-li@users.noreply.github.com> Date: Mon, 6 Nov 2023 08:59:08 -0800 Subject: [PATCH 5/5] Reverted datetime format --- daras_ai_v2/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daras_ai_v2/settings.py b/daras_ai_v2/settings.py index 3c4340420..97cdd3f2e 100644 --- a/daras_ai_v2/settings.py +++ b/daras_ai_v2/settings.py @@ -153,7 +153,7 @@ USE_TZ = True -DATETIME_FORMAT = "N j, h:i A" +DATETIME_FORMAT = "N j, D, Y, h:i:s A" from django.conf.locale.en import formats as es_formats