fcurella/django-social-share

KeyError 'request' in social share

bl-deepakchawla opened this issue · 0 comments

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

 def get(self, request):
        from django.template import Context, Template

        t = Template('{% load social_share %} {% post_to_linkedin object.title object_or_url "Post to LinkedIn" %}')

        c = Context({'message': 'Your message'})
        html = t.render(c)
        return Response(html)