db6587bae44521fed47d380aaf331b5f81171db4
[qcg-portal.git] / filex / forms.py
1 # coding=utf-8
2 from django import forms
3
4 from filex.models import Favorite
5
6
7 class FavoriteForm(forms.ModelForm):
8     class Meta:
9         model = Favorite
10         fields = ('owner', 'host', 'path')
11         widgets = {'owner': forms.HiddenInput()}
12
13
14 class NewDirForm(forms.Form):
15     host = forms.CharField(label=u'Host', max_length=256, widget=forms.HiddenInput())
16     path = forms.CharField(label=u'Ścieżka', max_length=1024, widget=forms.HiddenInput())
17     name = forms.CharField(label=u'Nazwa', max_length=256)
18
19
20 class RenameForm(forms.Form):
21     host = forms.CharField(label=u'Host', max_length=256, widget=forms.HiddenInput())
22     path = forms.CharField(label=u'Ścieżka', max_length=1024, widget=forms.HiddenInput())
23     src = forms.CharField(label=u'Stara nazwa', max_length=256, widget=forms.HiddenInput())
24     dst = forms.CharField(label=u'Nowa nazwa', max_length=256)
25
26
27 class ArchiveForm(NewDirForm):
28     ZIP = '.zip'
29     GZIP = '.tar.gz'
30     BZIP = '.tar.bz2'
31
32     TYPE_CHOICES = (
33         (ZIP, 'Archiwum zip'),
34         (GZIP, 'Archiwum tar.gz'),
35         (BZIP, 'Archiwum tar.bz2'),
36     )
37
38     type = forms.ChoiceField(label=u'Typ', choices=TYPE_CHOICES, initial=ZIP)