summaryrefslogtreecommitdiff
path: root/ishtar/furnitures/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2010-12-31 20:05:38 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2010-12-31 20:05:38 +0100
commitcb791561a7668f1f21b0f28f46e6d85bda52ad37 (patch)
tree7f9b04784c7a4334dcf502fc2a272866682e6cc9 /ishtar/furnitures/forms.py
parentef4a13bd49ea9afa286381bb11510efb1b0d76e9 (diff)
downloadIshtar-cb791561a7668f1f21b0f28f46e6d85bda52ad37.tar.bz2
Ishtar-cb791561a7668f1f21b0f28f46e6d85bda52ad37.zip
Better usage of AJAX autocomplete field
Diffstat (limited to 'ishtar/furnitures/forms.py')
-rw-r--r--ishtar/furnitures/forms.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py
index 367e97cb1..7f9347197 100644
--- a/ishtar/furnitures/forms.py
+++ b/ishtar/furnitures/forms.py
@@ -68,7 +68,9 @@ class FileWizard(Wizard):
class FileForm1(forms.Form):
in_charge = forms.IntegerField(label=_("Person in charge"),
- widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person')))
+ widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person'),
+ associated_model=models.Person),
+ validators=[models.Person.valid_id])
year = forms.IntegerField(label=_("Year"),
initial=lambda:datetime.datetime.now().year)
internal_reference = forms.CharField(label=_(u"Internal reference"),
@@ -76,8 +78,9 @@ class FileForm1(forms.Form):
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)
+ choices=models.FileType.get_types())
+ comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea,
+ required=False)
class FileForm2(forms.Form):