forms.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # GNU MediaGoblin -- federated, autonomous media hosting
  2. # Copyright (C) 2011, 2012 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. from wtforms.ext.sqlalchemy.fields import QuerySelectField
  18. from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
  19. class MediaCommentForm(wtforms.Form):
  20. comment_content = wtforms.TextAreaField(
  21. _('Comment'),
  22. [wtforms.validators.InputRequired()],
  23. description=_(u'You can use '
  24. u'<a href="http://daringfireball.net/projects/markdown/basics" target="_blank">'
  25. u'Markdown</a> for formatting.'))
  26. class ConfirmDeleteForm(wtforms.Form):
  27. confirm = wtforms.BooleanField(
  28. _('I am sure I want to delete this'))
  29. class ConfirmCollectionItemRemoveForm(wtforms.Form):
  30. confirm = wtforms.BooleanField(
  31. _('I am sure I want to remove this item from the collection'))
  32. class MediaCollectForm(wtforms.Form):
  33. collection = QuerySelectField(
  34. _('Collection'),
  35. allow_blank=True, blank_text=_('-- Select --'), get_label='title',)
  36. note = wtforms.TextAreaField(
  37. _('Include a note'),
  38. [wtforms.validators.Optional()],)
  39. collection_title = wtforms.StringField(
  40. _('Title'),
  41. [wtforms.validators.Length(min=0, max=500)])
  42. collection_description = wtforms.TextAreaField(
  43. _('Description of this collection'),
  44. description=_("""You can use
  45. <a href="http://daringfireball.net/projects/markdown/basics" target="_blank">
  46. Markdown</a> for formatting."""))
  47. class CommentReportForm(wtforms.Form):
  48. report_reason = wtforms.TextAreaField(
  49. _('Reason for Reporting'),
  50. [wtforms.validators.InputRequired()])
  51. reporter_id = wtforms.HiddenField('')
  52. class MediaReportForm(wtforms.Form):
  53. report_reason = wtforms.TextAreaField(
  54. _('Reason for Reporting'),
  55. [wtforms.validators.InputRequired()])
  56. reporter_id = wtforms.HiddenField('')