django frontend login: TypeError at /auth/login dict expected at most 1 arguments, got 2
<p>In the project im working on the admin site is working fine and i want to test the frontend. But im Getting: </p>

<p>TypeError at /auth/login</p>

<p>dict expected at most 1 arguments, got 2</p>

<p>Here the full traceback:</p>

<pre><code>Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/auth/login?next=/

Django Version: 1.10
Python Version: 2.7.10
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.gis',
 'django_nose',
 'widget_tweaks',
 'rest_framework',
 'rest_framework_gis',
 'backbone_app',
 'accounts',
 'map')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware')



Traceback:

File "D:\SHK\ElektroClean\lib\site-packages\django\core\handlers\exception.py" in inner
  39.             response = get_response(request)

File "D:\SHK\ElektroClean\lib\site-packages\django\core\handlers\base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "D:\SHK\ElektroClean\lib\site-packages\django\core\handlers\base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "D:\SHK\ElektroClean\lib\site-packages\django\core\handlers\base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "D:\SHK\ElektroClean\accounts\views.py" in login_view
  47.     return render(request, 'login.html', context)

File "D:\SHK\ElektroClean\lib\site-packages\django\shortcuts.py" in render
  30.     content = loader.render_to_string(template_name, context, request, using=using)

File "D:\SHK\ElektroClean\lib\site-packages\django\template\loader.py" in render_to_string
  68.     return template.render(context, request)

File "D:\SHK\ElektroClean\lib\site-packages\django\template\backends\django.py" in render
  64.         context = make_context(context, request, autoescape=self.backend.engine.autoescape)

File "D:\SHK\ElektroClean\lib\site-packages\django\template\context.py" in make_context
  267.             context.push(original_context)

File "D:\SHK\ElektroClean\lib\site-packages\django\template\context.py" in push
  59.         return ContextDict(self, *dicts, **kwargs)

File "D:\SHK\ElektroClean\lib\site-packages\django\template\context.py" in __init__
  18.         super(ContextDict, self).__init__(*args, **kwargs)

Exception Type: TypeError at /auth/login
Exception Value: dict expected at most 1 arguments, got 2
</code></pre>

<p>This is the urls.py :</p>

<pre><code>urlpatterns = [
    url(r'^map/', include('map.urls')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^auth/', include('accounts.urls')),
    url(r'^', include('backbone_app.urls')),
</code></pre>

<p>and the other</p>

<pre><code>app_name = 'accounts'
urlpatterns = [
    url(r'^auth/', views.auth_view, name='auth_view'),
    url(r'login', views.login_view, name='login'),
    url(r'logout', views.logout_view, name='logout'),
    url(r'invalid', views.invalid_view, name='invalid'),
]
</code></pre>

<p>This is the views.py :</p>

<pre><code>def login_view(request):
    context = RequestContext(request)
    if request.method == "POST":
        username = request.POST['username']
        password = request.POST['password']
        user = authenticate(username=username, password=password)
        if user is not None:
            context['user'] = user
            if user.is_active:
                login(request, user)
                return HttpResponseRedirect('/')     #Redirect to a success page
            else:
                return HttpResponseRedirect('auth/invalid')
        else:
            return HttpResponse('Passwort oder Username falsch')        
    return render(request, 'login.html', context)
</code></pre>

<p>where's my Problem ? Please help. </p>

<p>Thanks</p>

<p>The <code>render</code> function is expecting a dictionary not a RequestContext object. Change your return line in your login_view to something like this:</p>

<pre><code>return render(request, 'login.html', {'context': context})
</code></pre>

python django