diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-08-27 19:53:17 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-08-27 19:53:17 +0200 |
commit | 427a05d328fccc99a9339dbc6c933281eaaaa3b9 (patch) | |
tree | b0c7cbf440ff5b29e71074a35e542b1aaffa8dc4 /forms.py | |
parent | cfd0b613480a841bb82c67f0354b44b8d1f5063c (diff) | |
download | Chimère - projet Saclay-427a05d328fccc99a9339dbc6c933281eaaaa3b9.tar.bz2 Chimère - projet Saclay-427a05d328fccc99a9339dbc6c933281eaaaa3b9.zip |
Work on form panel
Diffstat (limited to 'forms.py')
-rw-r--r-- | forms.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/forms.py b/forms.py new file mode 100644 index 0000000..77e9648 --- /dev/null +++ b/forms.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# See the file COPYING for details. + +""" +Forms +""" +from django import forms +from django.utils.translation import ugettext as _ + +from chimere.models import SubCategory +from chimere.forms import MarkerForm as BaseMarkerForm +from chimere.widgets import TextareaWidget + +class MarkerForm(BaseMarkerForm): + categories = forms.ChoiceField(choices=[], widget=forms.Select) + description = forms.CharField(widget=TextareaWidget) + + def __init__(self, *args, **kwargs): + super(MarkerForm, self).__init__(*args, **kwargs) + self.fields['categories'].widget.choices = [('', _(u"Select"))] + \ + SubCategory.getAvailableTuples() + |