Skip to content

Commit

Permalink
user model changes
Browse files Browse the repository at this point in the history
  • Loading branch information
surbhi-posthog committed Dec 20, 2024
1 parent 8035e01 commit f2fd3fe
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
31 changes: 31 additions & 0 deletions posthog/migrations/0536_user_role_at_organization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2.15 on 2024-12-20 16:56

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("posthog", "0535_alter_hogfunction_type"),
]

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,
),
),
]
2 changes: 1 addition & 1 deletion posthog/migrations/max_migration.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0535_alter_hogfunction_type
0536_user_role_at_organization
12 changes: 12 additions & 0 deletions posthog/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -154,6 +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

Expand Down

0 comments on commit f2fd3fe

Please sign in to comment.