Add new BaseRole
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
# Generated by Django 3.2.14 on 2022-08-03 20:14
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('kaehmy', '0007_alter_commentparent_id'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='BaseRole',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
('name', models.CharField(max_length=255, verbose_name='Name')),
|
||||||
|
('is_board', models.BooleanField(verbose_name='Board member')),
|
||||||
|
('category', models.CharField(choices=[('corporate', 'Corporate affairs'), ('freshman', 'Freshmen'), ('international', 'International'), ('external', 'External affairs'), ('media', 'Media'), ('tech', 'Technology'), ('wellbeing', 'Wellbeing'), ('elepaja', 'Elepaja'), ('ceremonies', 'Ceremonies'), ('studies', 'Studies'), ('sosso', 'Sössö magazine'), ('alumni', 'Alumni relations'), ('others', 'Others')], default='others', max_length=255, verbose_name='Category')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
+33
-2
@@ -1,7 +1,7 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from webapp.models import BaseRole
|
from webapp.models import BaseRole as OldBaseRole
|
||||||
|
|
||||||
|
|
||||||
# TODO: Move BaseRole to Kaehmt App; will fuck up the DB since table is removed, if no data migration is done before-hand.
|
# TODO: Move BaseRole to Kaehmt App; will fuck up the DB since table is removed, if no data migration is done before-hand.
|
||||||
@@ -13,7 +13,38 @@ from webapp.models import BaseRole
|
|||||||
VERBOSE_NAME = _("Kaehmy")
|
VERBOSE_NAME = _("Kaehmy")
|
||||||
|
|
||||||
|
|
||||||
class KaehmyBaseRole(BaseRole):
|
class BaseRole(models.Model):
|
||||||
|
"""Base model for occupations/roles."""
|
||||||
|
|
||||||
|
id = models.AutoField(primary_key=True)
|
||||||
|
name = models.CharField(_("Name"), max_length=255)
|
||||||
|
is_board = models.BooleanField(_("Board member"))
|
||||||
|
|
||||||
|
CATEGORIES = (
|
||||||
|
("corporate", _("Corporate affairs")),
|
||||||
|
("freshman", _("Freshmen")),
|
||||||
|
("international", _("International")),
|
||||||
|
("external", _("External affairs")),
|
||||||
|
("media", _("Media")),
|
||||||
|
("tech", _("Technology")),
|
||||||
|
("wellbeing", _("Wellbeing")),
|
||||||
|
("elepaja", _("Elepaja")),
|
||||||
|
("ceremonies", _("Ceremonies")),
|
||||||
|
("studies", _("Studies")),
|
||||||
|
("sosso", _("Sössö magazine")),
|
||||||
|
("alumni", _("Alumni relations")),
|
||||||
|
("others", _("Others")),
|
||||||
|
)
|
||||||
|
category = models.CharField(
|
||||||
|
_("Category"), choices=CATEGORIES, default="others", max_length=255
|
||||||
|
)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
n = self.name.capitalize()
|
||||||
|
return "{} ({})".format(n, _("board member")) if self.is_board else n
|
||||||
|
|
||||||
|
|
||||||
|
class KaehmyBaseRole(OldBaseRole):
|
||||||
"""ABC"""
|
"""ABC"""
|
||||||
|
|
||||||
CATEGORIES = (
|
CATEGORIES = (
|
||||||
|
|||||||
Reference in New Issue
Block a user