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

TemplateView's get_context only accept kwargs!#393

Open
ramast wants to merge 1 commit intobread-and-pepper:masterfrom
ramast:master
Open

TemplateView's get_context only accept kwargs!#393
ramast wants to merge 1 commit intobread-and-pepper:masterfrom
ramast:master

Conversation

@ramast
Copy link
Copy Markdown

@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)

Copy link
Copy Markdown
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