New kaehmy BaseRole class

This commit is contained in:
Aarni Halinen
2018-09-02 22:03:54 +03:00
parent b154ffb79e
commit 499ddc0979
6 changed files with 123 additions and 28 deletions
+2 -3
View File
@@ -2,8 +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
from webapp.models import BaseRole
from kaehmy.models import PresetRole, CustomRole, Application, Comment, KaehmyBaseRole
class CheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple):
@@ -42,7 +41,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 BaseRole.CATEGORIES:
for cat_id, category in KaehmyBaseRole.CATEGORIES:
key = 'preset_roles_{}'.format(cat_id)
qset = PresetRole.objects.filter(category=cat_id).order_by('category', '-is_board')
self.fields[key] = forms.ModelMultipleChoiceField(qset)