Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

TemplateView's get_context only accept kwargs! #393

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

TemplateView's get_context only accept kwargs! #393

wants to merge 1 commit into from

Conversation

ramast
Copy link

@ramast ramast commented Feb 27, 2014

The super class of ExtraContextTemplateView is TemplateView which inherit its get_context_data from ContextMixin
Definition of get_context in ConextMixin is
def get_context_data(self, **kwargs):
so passing *args is wrong and for some reasons started to make project crash

  File "/home/ramast/PycharmProjects/chipcow_env/lib/python2.7/site-packages/django/views/generic/base.py", line 153, in get
    context = self.get_context_data(self, **kwargs)
  File "/home/ramast/PycharmProjects/chipcow_env/lib/python2.7/site-packages/userena/views.py", line 34, in get_context_data
    context = super(ExtraContextTemplateView, self).get_context_data(*args, **kwargs)
TypeError: get_context_data() takes exactly 1 argument (2 given)

@@ -31,7 +31,7 @@ class ExtraContextTemplateView(TemplateView):
extra_context = None

def get_context_data(self, *args, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, good catch. Thanks.

But this line should also be changed to (self, **kwargs) to make it more consistent. Could you do that? After that I will merge it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants