From 8c8acd3e191ccd93a4cdbf3dcc722775d81e0f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80=20=D0=93=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D0=BA=D0=B8=D1=85?= Date: Fri, 6 Dec 2019 11:13:07 +0300 Subject: [PATCH] Models --- .../0024_role_establishment_subtype.py | 20 +++++++++++++++++++ apps/account/models.py | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 apps/account/migrations/0024_role_establishment_subtype.py diff --git a/apps/account/migrations/0024_role_establishment_subtype.py b/apps/account/migrations/0024_role_establishment_subtype.py new file mode 100644 index 00000000..3b9062c5 --- /dev/null +++ b/apps/account/migrations/0024_role_establishment_subtype.py @@ -0,0 +1,20 @@ +# Generated by Django 2.2.7 on 2019-12-06 06:55 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('establishment', '0067_auto_20191122_1244'), + ('account', '0023_auto_20191204_0916'), + ] + + operations = [ + migrations.AddField( + model_name='role', + name='establishment_subtype', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='establishment.EstablishmentSubType', verbose_name='Establishment subtype'), + ), + ] diff --git a/apps/account/models.py b/apps/account/models.py index 53163d95..8f6c6233 100644 --- a/apps/account/models.py +++ b/apps/account/models.py @@ -1,5 +1,6 @@ """Account models""" from datetime import datetime +from tabnanny import verbose from django.conf import settings from django.contrib.auth.models import AbstractUser, UserManager as BaseUserManager @@ -15,7 +16,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework.authtoken.models import Token from authorization.models import Application -from establishment.models import Establishment +from establishment.models import Establishment, EstablishmentSubType from location.models import Country from main.models import SiteSettings from utils.models import GMTokenGenerator @@ -54,6 +55,9 @@ class Role(ProjectBaseMixin): null=True, blank=True, on_delete=models.SET_NULL) site = models.ForeignKey(SiteSettings, verbose_name=_('Site settings'), null=True, blank=True, on_delete=models.SET_NULL) + establishment_subtype = models.ForeignKey(EstablishmentSubType, + verbose_name=_('Establishment subtype'), + null=True, blank=True, on_delete=models.SET_NULL) class UserManager(BaseUserManager):