Wednesday, September 14, 2016

Re: creating a loginpage

On 14 September 2016 at 17:44, Timothy Steele
<steeletimothy2000@gmail.com> wrote:
> Instead of providing the view itself, i want to pass its module path as a
> string in the urls.py file as the code below
>
> urlpatterns = ['',
> url(r'^$', main_page),
> url(r'^user/(\w+)/$', user_page),
> url(r'^login/$', 'django.contrib.auth.views.login'),
> ]

Use include() [1] for that, there are further info at [2] including a
shorthand for registering several urls at once and a login form
template.


[1]: https://docs.djangoproject.com/en/1.10/ref/urls/#include
[2]: https://docs.djangoproject.com/en/1.10/topics/auth/default/

--
Andrea

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMonFrTVuJqx3qdiptYnb%2BLbcwtrnJs9dojwf-%3DxHf-GyrGduQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment