Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Introduce BLOG_DOCUTILS_SETTINGS for easier configurability.

  • Loading branch information...
commit 14966e8f40dcc7a7f78d63946139088180916675 1 parent 8343c63
@jphalip jphalip authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 django_website/blog/models.py
View
17 django_website/blog/models.py
@@ -11,6 +11,14 @@
+BLOG_DOCUTILS_SETTINGS = getattr(settings, 'BLOG_DOCUTILS_SETTINGS',
+ { 'doctitle_xform': False,
+ 'initial_header_level': 4,
+ 'id_prefix': 's-',
+ }
+)
+
+
class EntryManager(models.Manager):
def published(self):
@@ -67,17 +75,12 @@ def save(self, *args, **kwargs):
self.summary_html = self.summary
self.body_html = self.body
elif self.content_format == u'reST':
- settings_overrides = {
- 'doctitle_xform': False,
- 'initial_header_level': 4,
- 'id_prefix': 's-',
- }
self.summary_html = publish_parts(source=smart_str(self.summary),
writer_name="html",
- settings_overrides=settings_overrides)['fragment']
+ settings_overrides=BLOG_DOCUTILS_SETTINGS)['fragment']
self.body_html = publish_parts(source=smart_str(self.body),
writer_name="html",
- settings_overrides=settings_overrides)['fragment']
+ settings_overrides=BLOG_DOCUTILS_SETTINGS)['fragment']
super(Entry, self).save(*args, **kwargs)
def moderate_comment(sender, comment, request, **kwargs):
Please sign in to comment.
Something went wrong with that request. Please try again.