don't save old value for host selector
[qcg-portal.git] / filex / forms.py
index a934aaf..db6587b 100644 (file)
@@ -1,6 +1,15 @@
 # coding=utf-8
 from django import forms
 
+from filex.models import Favorite
+
+
+class FavoriteForm(forms.ModelForm):
+    class Meta:
+        model = Favorite
+        fields = ('owner', 'host', 'path')
+        widgets = {'owner': forms.HiddenInput()}
+
 
 class NewDirForm(forms.Form):
     host = forms.CharField(label=u'Host', max_length=256, widget=forms.HiddenInput())
@@ -13,3 +22,17 @@ class RenameForm(forms.Form):
     path = forms.CharField(label=u'Ścieżka', max_length=1024, widget=forms.HiddenInput())
     src = forms.CharField(label=u'Stara nazwa', max_length=256, widget=forms.HiddenInput())
     dst = forms.CharField(label=u'Nowa nazwa', max_length=256)
+
+
+class ArchiveForm(NewDirForm):
+    ZIP = '.zip'
+    GZIP = '.tar.gz'
+    BZIP = '.tar.bz2'
+
+    TYPE_CHOICES = (
+        (ZIP, 'Archiwum zip'),
+        (GZIP, 'Archiwum tar.gz'),
+        (BZIP, 'Archiwum tar.bz2'),
+    )
+
+    type = forms.ChoiceField(label=u'Typ', choices=TYPE_CHOICES, initial=ZIP)