X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/0b7e02cf796af7d3028efabeb37473f9198d0af2..22aac0da99594406b261f14c135812c855c196ef:/apps/api/forms.py diff --git a/apps/api/forms.py b/apps/api/forms.py deleted file mode 100644 index 3c393a87..00000000 --- a/apps/api/forms.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- encoding: utf-8 -*- - -__author__= "Łukasz Rekucki" -__date__ = "$2009-09-20 21:34:52$" -__doc__ = "Micro-forms for the API." - - -from django import forms - - -class MergeRequestForm(forms.Form): - # should the target document revision be updated or shared - type = forms.ChoiceField(choices=('update', 'share')) - - # which revision to update/share - target_revision = forms.RegexField('[0-9a-f]{40}') - - # any additional comments that user wants to add to the change - comment = forms.CharField(required=False) - -class DocumentUploadForm(forms.Form): - ocr_file = forms.FileField(label='Source OCR file', required=False) - ocr_data = forms.CharField(widget=forms.HiddenInput(), required=False) - - bookname = forms.RegexField(regex=r'[0-9\.\w_-]+', \ - label='Publication name', help_text='Example: slowacki-beniowski') - - generate_dc = forms.BooleanField(required=False, \ - initial=True, label=u"Generate DublinCore template") - - - def clean(self): - clean_data = self.cleaned_data - - ocr_file = clean_data['ocr_file'] - ocr_data = clean_data['ocr_data'] - - if not ocr_file and not ocr_data: - raise forms.ValidationError( - "You must either provide file descriptor or raw data." ) - - return clean_data \ No newline at end of file