Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make the app work without django.core.context_processors.request too

Fixes: #8
  • Loading branch information...
commit e212b22a3337c080e0fc3274dac4c8c60e3b36b3 1 parent da56456
@vdboor vdboor authored
View
8 example/settings.py
@@ -59,14 +59,6 @@
'django.contrib.messages.middleware.MessageMiddleware',
)
-TEMPLATE_CONTEXT_PROCESSORS = (
- 'django.core.context_processors.i18n',
- 'django.core.context_processors.media',
- 'django.core.context_processors.request',
- 'django.core.context_processors.static',
- 'django.contrib.auth.context_processors.auth',
- 'django.contrib.messages.context_processors.messages',
-)
ROOT_URLCONF = 'urls'
View
16 fluent_comments/templatetags/fluent_comments_tags.py
@@ -1,3 +1,4 @@
+from django.conf import settings
from django.template import Library
from django.core import context_processors
from fluent_comments.models import get_comments_for_model
@@ -10,10 +11,19 @@ def ajax_comment_tags(context):
"""
Display the required ``<div>`` elements to let the Ajax comment functionality work with your form.
"""
- request = context['request']
+ new_context = {
+ 'STATIC_URL': context.get('STATIC_URL', None)
+ }
+
+ # Be configuration independent:
+ if new_context['STATIC_URL'] is None:
+ try:
+ request = context['request']
+ except KeyError:
+ new_context.update({'STATIC_URL': settings.STATIC_URL})
+ else:
+ new_context.update(context_processors.static(request))
- new_context = {}
- new_context.update(context_processors.static(request))
return new_context
Please sign in to comment.
Something went wrong with that request. Please try again.