Skip to content

Commit

Permalink
chore: add flavour fiels in user and user_pin tables (#24)
Browse files Browse the repository at this point in the history
Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>
  • Loading branch information
maxwellgithinji authored and ngurenyaga committed Nov 13, 2021
1 parent b907aee commit 84c10af
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mycarehub/users/migrations/0004_auto_20211112_1716.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.9 on 2021-11-12 14:16

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0003_auto_20211109_0922'),
]

operations = [
migrations.AddField(
model_name='user',
name='flavour',
field=models.CharField(choices=[('PRO', 'PRO'), ('CONSUMER', 'CONSUMER')], max_length=32, null=True),
),
migrations.AddField(
model_name='userpin',
name='flavour',
field=models.CharField(choices=[('PRO', 'PRO'), ('CONSUMER', 'CONSUMER')], max_length=32, null=True),
),
]
7 changes: 7 additions & 0 deletions mycarehub/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class GenderChoices(TextChoices):
FEMALE = "FEMALE", _("Female")


class FlavourChoices(TextChoices):
PRO = "PRO", _("PRO")
CONSUMER = "CONSUMER", _("CONSUMER")


def default_organisation():
try:
from mycarehub.common.models import Organisation # intentional late import
Expand Down Expand Up @@ -105,6 +110,7 @@ class User(AbstractUser):
on_delete=PROTECT,
default=default_organisation,
)
flavour = CharField(choices=FlavourChoices.choices, max_length=32, null=True)

@property
def permissions(self):
Expand Down Expand Up @@ -171,6 +177,7 @@ class UserPIN(Model):
created_by = UUIDField(null=True, blank=True)
updated = DateTimeField(default=timezone.now)
updated_by = UUIDField(null=True, blank=True)
flavour = CharField(choices=FlavourChoices.choices, max_length=32, null=True)

class Meta:
index_together = (
Expand Down

0 comments on commit 84c10af

Please sign in to comment.