forms.py 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. from django import forms
  2. from django.utils.translation import ugettext_lazy as _
  3. from misago.forms import Form
  4. from misago.utils.timezones import tzlist
  5. class UserForumOptionsForm(Form):
  6. newsletters = forms.BooleanField(required=False)
  7. timezone = forms.ChoiceField(choices=tzlist())
  8. hide_activity = forms.TypedChoiceField(choices=(
  9. (0, _("Show my presence to everyone")),
  10. (1, _("Show my presence to people I follow")),
  11. (2, _("Show my presence to nobody")),
  12. ), coerce=int)
  13. subscribe_start = forms.TypedChoiceField(choices=(
  14. (0, _("Don't watch")),
  15. (1, _("Put on watched threads list")),
  16. (2, _("Put on watched threads list and e-mail me when somebody replies")),
  17. ), coerce=int)
  18. subscribe_reply = forms.TypedChoiceField(choices=(
  19. (0, _("Don't watch")),
  20. (1, _("Put on watched threads list")),
  21. (2, _("Put on watched threads list and e-mail me when somebody replies")),
  22. ), coerce=int)
  23. allow_pds = forms.TypedChoiceField(choices=(
  24. (0, _("From everyone")),
  25. (1, _("From everyone but not members I ignore")),
  26. (2, _("From members I follow")),
  27. (2, _("From nobody")),
  28. ), coerce=int)
  29. layout = (
  30. (
  31. _("Privacy"),
  32. (
  33. ('hide_activity', {'label': _("Your Visibility"), 'help_text': _("If you want to, you can limit other members ability to track your presence on forums.")}),
  34. ('allow_pds', {'label': _("Allow Private Threads Invitations"), 'help_text': _("If you wish, you can restrict who can invite you to private threads. Keep in mind some groups or members may be allowed to override this preference.")}),
  35. )
  36. ),
  37. (
  38. _("Forum Options"),
  39. (
  40. ('timezone', {'label': _("Your Current Timezone"), 'help_text': _("If dates and hours displayed by forums are inaccurate, you can fix it by adjusting timezone setting.")}),
  41. ('newsletters', {'label': _("Newsletters"), 'help_text': _("On occasion board administrator may want to send e-mail message to multiple members."), 'inline': _("Yes, I want to subscribe forum newsletter")}),
  42. )
  43. ),
  44. (
  45. _("Watching Threads"),
  46. (
  47. ('subscribe_start', {'label': _("Threads I start")}),
  48. ('subscribe_reply', {'label': _("Threads I reply to")}),
  49. )
  50. ),
  51. )