From 5581f2ba0ffe55337259b52f563cf7f4b2311e73 Mon Sep 17 00:00:00 2001 From: Surbhi Date: Mon, 30 Dec 2024 12:48:44 -0500 Subject: [PATCH] user model changes --- .../0537_user_role_at_organization.py | 31 +++++++++++++++++++ posthog/migrations/max_migration.txt | 2 +- posthog/models/user.py | 13 +++++++- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 posthog/migrations/0537_user_role_at_organization.py diff --git a/posthog/migrations/0537_user_role_at_organization.py b/posthog/migrations/0537_user_role_at_organization.py new file mode 100644 index 0000000000000..82296ed585207 --- /dev/null +++ b/posthog/migrations/0537_user_role_at_organization.py @@ -0,0 +1,31 @@ +# Generated by Django 4.2.15 on 2024-12-30 17:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("posthog", "0536_alertconfiguration_skip_weekend"), + ] + + operations = [ + migrations.AddField( + model_name="user", + name="role_at_organization", + field=models.CharField( + blank=True, + choices=[ + ("engineering", "Engineering"), + ("data", "Data"), + ("product", "Product Management"), + ("founder", "Founder"), + ("leadership", "Leadership"), + ("marketing", "Marketing"), + ("sales", "Sales / Success"), + ("other", "Other"), + ], + max_length=64, + null=True, + ), + ), + ] diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt index 9920c6cf00577..3bcab991edbd4 100644 --- a/posthog/migrations/max_migration.txt +++ b/posthog/migrations/max_migration.txt @@ -1 +1 @@ -0536_alertconfiguration_skip_weekend +0537_user_role_at_organization diff --git a/posthog/models/user.py b/posthog/models/user.py index 3b25009931c7c..dfd2724c1560b 100644 --- a/posthog/models/user.py +++ b/posthog/models/user.py @@ -31,6 +31,17 @@ class Notifications(TypedDict, total=False): # We don't ned the following attributes in most cases, so we defer them by default DEFERED_ATTRS = ["requested_password_reset_at"] +ROLE_CHOICES = ( + ("engineering", "Engineering"), + ("data", "Data"), + ("product", "Product Management"), + ("founder", "Founder"), + ("leadership", "Leadership"), + ("marketing", "Marketing"), + ("sales", "Sales / Success"), + ("other", "Other"), +) + class UserManager(BaseUserManager): """Define a model manager for User model with no username field.""" @@ -154,7 +165,7 @@ class User(AbstractUser, UUIDClassicModel): default=True, help_text=_("Unselect this to temporarily disable an account."), ) - + role_at_organization = models.CharField(max_length=64, choices=ROLE_CHOICES, null=True, blank=True) # Preferences / configuration options theme_mode = models.CharField(max_length=20, null=True, blank=True, choices=ThemeMode.choices)