Skip to content

Commit

Permalink
fix(#168): passing request object in template context
Browse files Browse the repository at this point in the history
fixes #168
  • Loading branch information
ZendaInnocent authored and Radi85 committed Mar 28, 2021
1 parent f8bce7c commit 0e22c13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion comment/templatetags/comment_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def render_comments(obj, request, oauth=False):
context = DABContext(request, model_object=obj)
context.update({
'comment_form': CommentForm(request=request),
'oauth': oauth
'oauth': oauth,
'request': request,
})
return context

Expand Down
2 changes: 2 additions & 0 deletions comment/tests/test_template_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def test_render_comments(self):
# no pagination
self.assertEqual(data['comments'].count(), count) # parent comment only
self.assertEqual(data['login_url'], settings.LOGIN_URL)
# check if `request` object is passed in context template
self.assertEqual(data['request'], request)

@patch.object(settings, 'LOGIN_URL', None)
def test_render_comments_without_login_url(self):
Expand Down

0 comments on commit 0e22c13

Please sign in to comment.