Add CategoryFormField to the MotionForm
This commit is contained in:
parent
2614a1cb2f
commit
bc7be27131
@ -15,7 +15,7 @@ from django.utils.translation import ugettext as _
|
||||
|
||||
from openslides.utils.forms import CssClassMixin
|
||||
from openslides.utils.person import PersonFormField, MultiplePersonFormField
|
||||
from .models import Motion, Workflow
|
||||
from .models import Motion, Workflow, Category
|
||||
|
||||
|
||||
class BaseMotionForm(forms.ModelForm, CssClassMixin):
|
||||
@ -90,6 +90,12 @@ class MotionDisableVersioningMixin(forms.ModelForm):
|
||||
last_version will be used."""
|
||||
|
||||
|
||||
class MotionCategoryMixin(forms.ModelForm):
|
||||
"""Mixin to let the user choose the category for the motion."""
|
||||
|
||||
category = forms.ModelChoiceField(queryset=Category.objects.all(), required=False)
|
||||
|
||||
|
||||
class ConfigForm(CssClassMixin, forms.Form):
|
||||
"""Form for the configuration tab of OpenSlides."""
|
||||
motion_min_supporters = forms.IntegerField(
|
||||
|
@ -35,7 +35,7 @@ from openslides.agenda.models import Item
|
||||
from .models import (Motion, MotionSubmitter, MotionSupporter, MotionPoll,
|
||||
MotionVersion, State, WorkflowError, Category)
|
||||
from .forms import (BaseMotionForm, MotionSubmitterMixin, MotionSupporterMixin,
|
||||
MotionDisableVersioningMixin, ConfigForm)
|
||||
MotionDisableVersioningMixin, ConfigForm, MotionCategoryMixin)
|
||||
from .pdf import motions_to_pdf, motion_to_pdf
|
||||
|
||||
|
||||
@ -124,6 +124,7 @@ class MotionMixin(object):
|
||||
form_classes = [BaseMotionForm]
|
||||
if self.request.user.has_perm('motion.can_manage_motion'):
|
||||
form_classes.append(MotionSubmitterMixin)
|
||||
form_classes.append(MotionCategoryMixin)
|
||||
if config['motion_min_supporters'] > 0:
|
||||
form_classes.append(MotionSupporterMixin)
|
||||
if self.object:
|
||||
|
Loading…
Reference in New Issue
Block a user