diff --git a/docker-compose-swarm.yml b/docker-compose-swarm.yml index 0ef6330..0a97ea7 100644 --- a/docker-compose-swarm.yml +++ b/docker-compose-swarm.yml @@ -3,7 +3,7 @@ version: '3.6' services: cms: - image: androiddrew/datasketch:0.2.1 + image: androiddrew/datasketch:0.2.2 command: gunicorn cms.wsgi:application --bind 0.0.0.0:5000 --workers 3 deploy: replicas: 1 diff --git a/services/cms/blog/models.py b/services/cms/blog/models.py index 139cea0..26be21d 100644 --- a/services/cms/blog/models.py +++ b/services/cms/blog/models.py @@ -68,6 +68,12 @@ class BlogPage(Page): InlinePanel("gallery_images", label="Gallery images"), ] + def get_context(self, request, *args, **kwargs): + context = super().get_context(request, *args, **kwargs) + context["post"] = self + return context + + class BlogPageGalleryImage(Orderable): """ diff --git a/services/cms/blog/templates/blog/blog_page.html b/services/cms/blog/templates/blog/blog_page.html index e6eaf9b..95a76fc 100644 --- a/services/cms/blog/templates/blog/blog_page.html +++ b/services/cms/blog/templates/blog/blog_page.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% load wagtailcore_tags wagtailimages_tags %} +{% load wagtailcore_tags wagtailimages_tags custom_tags %} {% block body_class %}helvetica{% endblock %} @@ -18,25 +18,6 @@ {% endif %} {{ page.body|richtext }} - - -
- - + {% show_comments %} {% endblock %} \ No newline at end of file diff --git a/services/cms/blog/templates/blog/disqus.html b/services/cms/blog/templates/blog/disqus.html new file mode 100644 index 0000000..741c0be --- /dev/null +++ b/services/cms/blog/templates/blog/disqus.html @@ -0,0 +1,15 @@ +
+ + \ No newline at end of file diff --git a/services/cms/blog/templatetags/__init__.py b/services/cms/blog/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/services/cms/blog/templatetags/custom_tags.py b/services/cms/blog/templatetags/custom_tags.py new file mode 100644 index 0000000..87fc3ee --- /dev/null +++ b/services/cms/blog/templatetags/custom_tags.py @@ -0,0 +1,17 @@ +from django.template import Library +from django.conf import settings + +register = Library() + + +@register.inclusion_tag("blog/disqus.html", takes_context=True) +def show_comments(context): + if not settings.COMMENTING: + return {} + + new_context = { + "disqus_url": context["request"].get_raw_uri(), + "disqus_identifier": context["post"].slug + } + + return new_context diff --git a/services/cms/cms/context_processors.py b/services/cms/cms/context_processors.py deleted file mode 100644 index 8f5b143..0000000 --- a/services/cms/cms/context_processors.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.conf import settings - - -def commenting(context): - """Template context processor used to check if a COMMENTING setting is True""" - return {"commenting": settings.COMMENTING} - diff --git a/services/cms/cms/settings/base.py b/services/cms/cms/settings/base.py index 94033ce..c763673 100644 --- a/services/cms/cms/settings/base.py +++ b/services/cms/cms/settings/base.py @@ -72,7 +72,6 @@ TEMPLATES = [ "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", - "cms.context_processors.commenting" ] }, }