path('login/', auth_views.LoginView, {'template_name':'accounts/login.html'}
name='login'),
There's no comma to separate the kwarg dict from the `name` positional
argument. As you can see in the docs
https://docs.djangoproject.com/en/2.1/ref/urls/#path, the path function
takes four params:
>
> path('login/', auth_views.LoginView.as_view(), name='login'),
How does it re-direct to which page to open in above method? How does it
open the template the user wanted here? He is trying to open the page
'users/login.html' when users type: http://127.0.0.1/login/ on the browser.
I have
I suggest you that you use path in the url file. I made an implemantation
of login like this
from django.urls import include, path
from django.contrib.auth import views as auth_views
from generales.views import Home, SinPrivilegios, HomeSinPrivilegios
urlpatterns = [
path('', Home.as_view(
HI! I am having issues with django login . I want to use the default login
class with the html file "login.html". But I meet the below issue.
Please help me to fix it. Thanks a lot.
[image: image.png]
--
You received this message because you are subscribed to the Google Groups
"Django users
*#Import auth views*
from django.contrib.auth import views as auth_views
*#Use the views in the url*
path('login/', auth_views.LoginView.as_view(), name='login'),
Happy coding!
On Mon, Aug 27, 2018 at 6:29 PM Tim Vogt (Tim Vogt)
wrote:
> Hi Jason,
> Thank !
>
> my urls.py in /users looks li
you changed the import to something else, right? but you didn't change the
actual use of the old import to the new.
On Monday, August 27, 2018 at 8:05:03 AM UTC-4, Tim Vogt wrote:
>
> Thanks I tired bout get another error
>
> File "/Users/timvogt/Software_projects/learning_log/users/urls.py", li
Thanks I tired bout get another error
File "/Users/timvogt/Software_projects/learning_log/users/urls.py", line 15, in
url('login/', login, {'template_name': 'users/login.html'}, name='login'),
NameError: name 'login' is not defined
"""Defines URL patterns for users"""
from django.conf.ur
you're importing the wrong login. you need to import the login view.
almost there, just
from django.contrib.auth.views import LoginView
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails
8 matches
Mail list logo