2011-07-31 10:46:29 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
openslides.agenda.forms
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Forms for the agenda app.
|
|
|
|
|
2012-04-25 22:29:19 +02:00
|
|
|
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
2011-07-31 10:46:29 +02:00
|
|
|
:license: GNU GPL, see LICENSE for more details.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.forms import Form, ModelForm, IntegerField, ChoiceField, \
|
2012-03-16 14:31:59 +01:00
|
|
|
ModelChoiceField, HiddenInput, Select, TextInput
|
2011-07-31 10:46:29 +02:00
|
|
|
from django.utils.translation import ugettext as _
|
2012-02-20 00:14:54 +01:00
|
|
|
|
|
|
|
from mptt.forms import TreeNodeChoiceField
|
|
|
|
|
2012-02-20 18:44:02 +01:00
|
|
|
from utils.forms import CssClassMixin
|
|
|
|
|
2012-02-20 00:14:54 +01:00
|
|
|
from agenda.models import Item
|
2011-07-31 10:46:29 +02:00
|
|
|
|
2012-02-09 02:29:38 +01:00
|
|
|
|
2012-02-20 18:44:02 +01:00
|
|
|
class ItemForm(ModelForm, CssClassMixin):
|
2012-02-20 00:14:54 +01:00
|
|
|
parent = TreeNodeChoiceField(queryset=Item.objects.all(), label=_("Parent item"), required=False)
|
2011-07-31 10:46:29 +02:00
|
|
|
class Meta:
|
2012-02-06 22:22:16 +01:00
|
|
|
model = Item
|
2012-04-19 12:46:04 +02:00
|
|
|
exclude = ('closed', 'weight', 'releated_sid')
|
2011-07-31 10:46:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
def genweightchoices():
|
|
|
|
l = []
|
|
|
|
for i in range(-50, 51):
|
|
|
|
l.append(('%d' % i, i))
|
|
|
|
return l
|
|
|
|
|
|
|
|
|
2012-02-20 18:44:02 +01:00
|
|
|
class ItemOrderForm(Form, CssClassMixin):
|
2012-02-09 02:29:38 +01:00
|
|
|
weight = ChoiceField(choices=genweightchoices(),
|
2011-07-31 10:46:29 +02:00
|
|
|
widget=Select(attrs={'class': 'menu-weight'}),
|
|
|
|
label="")
|
|
|
|
self = IntegerField(widget=HiddenInput(attrs={'class': 'menu-mlid'}))
|
|
|
|
parent = IntegerField(widget=HiddenInput(attrs={'class': 'menu-plid'}))
|
2012-03-16 14:31:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ConfigForm(Form, CssClassMixin):
|
|
|
|
agenda_countdown_time = IntegerField(widget=TextInput(attrs={'class':'small-input'}),label=_("Countdown (in seconds)"),initial=60, min_value=0)
|