defaults.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. """
  2. Default settings for the ``mezzanine.blog`` app. Each of these can be
  3. overridden in your project's settings module, just like regular
  4. Django settings. The ``editable`` argument for each controls whether
  5. the setting is editable via Django's admin.
  6. Thought should be given to how a setting is actually used before
  7. making it editable, as it may be inappropriate - for example settings
  8. that are only read during startup shouldn't be editable, since changing
  9. them would require an application reload.
  10. """
  11. from __future__ import unicode_literals
  12. from django.conf import settings
  13. from django.utils.translation import ugettext_lazy as _
  14. from mezzanine.conf import register_setting
  15. register_setting(
  16. name="BLOG_USE_FEATURED_IMAGE",
  17. description=_("Enable featured images in blog posts"),
  18. editable=False,
  19. default=False,
  20. )
  21. _BLOG_URLS_DATE_FORMAT = ""
  22. if getattr(settings, "BLOG_URLS_USE_DATE", False):
  23. _BLOG_URLS_DATE_FORMAT = "day"
  24. from warnings import warn
  25. warn("BLOG_URLS_USE_DATE setting is deprecated, please use the "
  26. "BLOG_URLS_DATE_FORMAT setting with a value of 'year', 'month', "
  27. "or 'day'.")
  28. register_setting(
  29. name="BLOG_URLS_DATE_FORMAT",
  30. label=_("Blog post URL date format"),
  31. description=_("A string containing the value ``year``, ``month``, or "
  32. "``day``, which controls the granularity of the date portion in the "
  33. "URL for each blog post. Eg: ``year`` will define URLs in the format "
  34. "/blog/yyyy/slug/, while ``day`` will define URLs with the format "
  35. "/blog/yyyy/mm/dd/slug/. An empty string means the URLs will only "
  36. "use the slug, and not contain any portion of the date at all."),
  37. editable=False,
  38. default=_BLOG_URLS_DATE_FORMAT,
  39. )
  40. register_setting(
  41. name="BLOG_POST_PER_PAGE",
  42. label=_("Blog posts per page"),
  43. description=_("Number of blog posts shown on a blog listing page."),
  44. editable=True,
  45. default=5,
  46. )
  47. register_setting(
  48. name="BLOG_RSS_LIMIT",
  49. label=_("Blog posts RSS limit"),
  50. description=_("Number of most recent blog posts shown in the RSS feed. "
  51. "Set to ``None`` to display all blog posts in the RSS feed."),
  52. editable=False,
  53. default=20,
  54. )
  55. register_setting(
  56. name="BLOG_SLUG",
  57. description=_("Slug of the page object for the blog."),
  58. editable=False,
  59. default="blog",
  60. )