X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/4c48c47d0b84e516114c16ee191359166e93a51c..e2efa3c922eb796cf57f22fa4e2780defd8b7a20:/apps/catalogue/forms.py diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index 6a56e764..657a1b04 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -44,6 +44,8 @@ class DocumentsUploadForm(forms.Form): Form used for uploading new documents. """ file = forms.FileField(required=True, label=_('ZIP file')) + dirs = forms.BooleanField(label=_('Directories are documents in chunks'), + widget = forms.CheckboxInput(attrs={'disabled':'disabled'})) def clean(self): file = self.cleaned_data['file'] @@ -65,8 +67,8 @@ class ChunkForm(forms.ModelForm): """ user = forms.ModelChoiceField(queryset= User.objects.annotate(count=Count('chunk')). - order_by('-count', 'last_name', 'first_name'), required=False) - + order_by('-count', 'last_name', 'first_name'), required=False, + label=_('Assigned to')) class Meta: model = Chunk @@ -102,9 +104,13 @@ class BookAppendForm(forms.Form): Form for appending a book to another book. It means moving all chunks from book A to book B and deleting A. """ - append_to = forms.ModelChoiceField(queryset=Book.objects.all(), - label=_("Append to")) + label=_("Append to")) + + def __init__(self, book, *args, **kwargs): + ret = super(BookAppendForm, self).__init__(*args, **kwargs) + self.fields['append_to'].queryset = Book.objects.exclude(pk=book.pk) + return ret class BookForm(forms.ModelForm):