Remove webapp BaseRole

This commit is contained in:
Aarni Halinen
2022-07-26 20:53:25 +03:00
parent 9678b663a0
commit 93e122b8a8
5 changed files with 35 additions and 38 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
from kaehmy.models import PresetRole, CustomRole, Application, Comment, KaehmyBaseRole
from kaehmy.models import PresetRole, CustomRole, Application, Comment, BaseRole
class CheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple):
@@ -57,7 +57,7 @@ class ApplicationForm(forms.ModelForm):
self.fields["custom_roles"].label = _("Custom roles")
self.fields["custom_roles"].queryset = CustomRole.objects.all()
for cat_id, category in KaehmyBaseRole.CATEGORIES:
for cat_id, category in BaseRole.CATEGORIES:
key = "preset_roles_{}".format(cat_id)
qset = PresetRole.objects.filter(category=cat_id).order_by(
"category", "-is_board"
@@ -0,0 +1,16 @@
# Generated by Django 3.2.14 on 2022-08-03 20:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('kaehmy', '0010_auto_20220726_2033'),
]
operations = [
migrations.DeleteModel(
name='KaehmyBaseRole',
),
]
-24
View File
@@ -1,7 +1,6 @@
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
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.
@@ -44,29 +43,6 @@ class BaseRole(models.Model):
return "{} ({})".format(n, _("board member")) if self.is_board else n
class KaehmyBaseRole(OldBaseRole):
"""ABC"""
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
)
class PresetRole(BaseRole):
"""Model for kaehmy role."""