diff options
Diffstat (limited to 'ishtar/furnitures')
| -rw-r--r-- | ishtar/furnitures/forms.py | 38 | ||||
| -rw-r--r-- | ishtar/furnitures/models.py | 2 |
2 files changed, 26 insertions, 14 deletions
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py index 33a58cbfd..e547c6ffb 100644 --- a/ishtar/furnitures/forms.py +++ b/ishtar/furnitures/forms.py @@ -20,6 +20,8 @@ """ Forms definition """ +import datetime + from django.utils.translation import ugettext_lazy as _ from django.template import Context from django.shortcuts import render_to_response @@ -38,19 +40,7 @@ class Step(BasicStep): self.label = label super(Step, self).__init__(idx, form) -class FileForm1(forms.Form): - subject = forms.CharField(max_length=100) - sender = forms.EmailField() - -class FileForm2(forms.Form): - subject2 = forms.CharField(max_length=100) - sender2 = forms.EmailField() - -class FileWizard(SessionWizard): - def get_template(self, request, step, form): - return ['templates/file_wizard_%s.html' % step, - 'file_wizard.html'] - +class Wizard(SessionWizard): def process_show_form(self, request, step, form): previous_steps = [] for stp in self.base_steps: @@ -60,7 +50,29 @@ class FileWizard(SessionWizard): previous_steps.append(stp) return Context({'previous_steps':previous_steps}) +class FileWizard(Wizard): + def get_template(self, request, step, form): + return ['templates/file_wizard_%s.html' % step, + 'file_wizard.html'] + def done(self, request, form_list): return render_to_response('done.html', { 'form_data': [form.cleaned_data for form in form_list], }) + +class FileForm1(forms.Form): + in_charge = forms.IntegerField(label=_("Person in charge")) + year = forms.IntegerField(label=_("Year"), + initial=lambda:datetime.datetime.now().year) + internal_reference = forms.CharField(label=_(u"Internal reference"), + max_length=60) + creation_date = forms.DateField(label=_(u"Creation date"), + initial=datetime.datetime.now) + file_type = forms.ChoiceField(label=_("File type"), + choices=models.FileType.objects.filter(available=True)) + comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea) + + +class FileForm2(forms.Form): + town = forms.IntegerField(label=_(u"Town")) + diff --git a/ishtar/furnitures/models.py b/ishtar/furnitures/models.py index ee488d52c..f770fc6c6 100644 --- a/ishtar/furnitures/models.py +++ b/ishtar/furnitures/models.py @@ -182,7 +182,7 @@ class File(BaseHistorizedItem, OwnPerms): max_length=60) file_type = models.ForeignKey(FileType, verbose_name=_(u"File type")) in_charge = models.ForeignKey(Person, related_name='+', - verbose_name=_(u"Person in charge")) + verbose_name=_(u"Person in charge")) general_contractor = models.ForeignKey(Organization, related_name='+', verbose_name=_(u"General contractor"), blank=True, null=True) is_active = models.BooleanField(_(u"Is active?")) |
