form.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # @Author : lightXu
  2. # @File : form.py
  3. from django import forms
  4. SUBJECT_ID = ((0, '未知学科'),
  5. (3, '数学'),
  6. (6, '数学(知心慧学)'),
  7. (8, '英语'),
  8. (9, '语文'),
  9. (12, '物理'),
  10. (13, '化学'),
  11. (14, '生物'),
  12. (15, '政治'),
  13. (16, '历史'),
  14. (17, '地理'),
  15. (18, '理综'),
  16. (19, '文综'),
  17. (98, '英语-B'),
  18. (99, '英语-T'),
  19. )
  20. class UploadImageForm(forms.Form):
  21. subject_id_dict = SUBJECT_ID
  22. subject = forms.ChoiceField(label='科目', label_suffix=':', widget=forms.Select(),
  23. choices=subject_id_dict, initial=3, required=True, )
  24. img_data = forms.ImageField(label='试卷图片', label_suffix=':',
  25. widget=forms.ClearableFileInput(attrs={'multiple': True}))
  26. class UploadImageWithPaperIdForm(forms.Form):
  27. subject_id_dict = SUBJECT_ID
  28. subject = forms.ChoiceField(label='科目', label_suffix=':', widget=forms.Select(),
  29. choices=subject_id_dict, initial=3, required=True, )
  30. paper_id = forms.CharField(label='PaperID', label_suffix=':',)
  31. img_data = forms.ImageField(label='试卷图片', label_suffix=':',
  32. widget=forms.ClearableFileInput(attrs={'multiple': True}))
  33. class FormulaUrlForm(forms.Form):
  34. img_url = forms.CharField(label='试卷URL', label_suffix=':')
  35. # class UploadFileForm(forms.Form):
  36. # # xml_file = forms.FileField(label='XML', label_suffix=':',
  37. # # widget=forms.ClearableFileInput(attrs={'multiple': True}))
  38. # xml_file = forms.FileField(label='XML', label_suffix=':',
  39. # widget=forms.ClearableFileInput(attrs={'multiple': True}))
  40. class SubmitSeriesNumberForm(forms.Form):
  41. series_number = forms.CharField(label='series_number', label_suffix=':', max_length=100)
  42. class DownloadImage(forms.Form):
  43. paper_id = forms.CharField(label='paper_id', label_suffix=':', max_length=100)
  44. class UploadFileForm(forms.Form):
  45. subject_id_dict = SUBJECT_ID
  46. subject = forms.ChoiceField(label='科目', label_suffix=':', widget=forms.Select(),
  47. choices=subject_id_dict, initial=3, required=True, )
  48. img_data = forms.FileField(label='试卷PDF', label_suffix=':',
  49. widget=forms.ClearableFileInput(attrs={'multiple': True}))