forms.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from django import forms
  2. from django.utils.translation import gettext_lazy as _
  3. from ...admin.forms import YesNoSwitch
  4. from ...conf.admin.forms import ChangeSettingsForm
  5. class ChangeGeneralSettingsForm(ChangeSettingsForm):
  6. settings = [
  7. "forum_name",
  8. "forum_index_title",
  9. "forum_index_meta_description",
  10. "forum_branding_display",
  11. "forum_branding_text",
  12. "forum_footnote",
  13. "email_footer",
  14. ]
  15. forum_name = forms.CharField(label=_("Forum name"), min_length=2, max_length=255)
  16. forum_index_title = forms.CharField(
  17. label=_("Title"),
  18. help_text=_("You may set a custom title on forum index by typing it here."),
  19. max_length=255,
  20. required=False,
  21. )
  22. forum_index_meta_description = forms.CharField(
  23. label=_("Meta Description"),
  24. help_text=_("Short description of your forum for internet crawlers."),
  25. max_length=255,
  26. required=False,
  27. )
  28. forum_branding_display = YesNoSwitch(
  29. label=_("Display branding"), help_text=_("Switch branding in forum's navbar.")
  30. )
  31. forum_branding_text = forms.CharField(
  32. label=_("Branding text"),
  33. help_text=_("Optional text displayed besides brand image in navbar."),
  34. max_length=255,
  35. required=False,
  36. )
  37. forum_footnote = forms.CharField(
  38. label=_("Forum footnote"),
  39. help_text=_("Short message displayed in forum footer."),
  40. max_length=300,
  41. required=False,
  42. )
  43. email_footer = forms.CharField(
  44. label=_("E-mails footer"),
  45. help_text=_(
  46. "Optional short message included at the end of e-mails sent by forum."
  47. ),
  48. max_length=255,
  49. required=False,
  50. )