forms.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # GNU MediaGoblin -- federated, autonomous media hosting
  2. # Copyright (C) 2013 MediaGoblin contributors. See AUTHORS.
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. import wtforms
  17. class AddSimpleForm(wtforms.Form):
  18. image = wtforms.FileField()
  19. name = wtforms.StringField(
  20. validators=[wtforms.validators.Length(min=0, max=500)])
  21. comment = wtforms.StringField()
  22. # tags = wtforms.FieldList(wtforms.StringField())
  23. category = wtforms.IntegerField()
  24. level = wtforms.IntegerField()
  25. _md5_validator = wtforms.validators.Regexp(r"^[0-9a-fA-F]{32}$")
  26. class AddForm(wtforms.Form):
  27. original_sum = wtforms.StringField(None,
  28. [_md5_validator,
  29. wtforms.validators.InputRequired()])
  30. thumbnail_sum = wtforms.StringField(None,
  31. [wtforms.validators.Optional(),
  32. _md5_validator])
  33. file_sum = wtforms.StringField(None, [_md5_validator])
  34. name = wtforms.StringField()
  35. date_creation = wtforms.StringField()
  36. categories = wtforms.StringField()