diff options
author | ankitjavalkar | 2017-07-25 18:25:20 +0530 |
---|---|---|
committer | GitHub | 2017-07-25 18:25:20 +0530 |
commit | fa14c2b19896000fce61d64d073e7ab549f8548d (patch) | |
tree | bc4d08aabf31cda37e9f5cb26761ca4f8e253848 /tutorial_9_create_login | |
parent | f77ed6057e775c50c04ca6c2d97a4ff820b9ef85 (diff) | |
download | learn_django-fa14c2b19896000fce61d64d073e7ab549f8548d.tar.gz learn_django-fa14c2b19896000fce61d64d073e7ab549f8548d.tar.bz2 learn_django-fa14c2b19896000fce61d64d073e7ab549f8548d.zip |
Add more slides
Diffstat (limited to 'tutorial_9_create_login')
-rw-r--r-- | tutorial_9_create_login/slides.md | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/tutorial_9_create_login/slides.md b/tutorial_9_create_login/slides.md index be6eb84..9564d9f 100644 --- a/tutorial_9_create_login/slides.md +++ b/tutorial_9_create_login/slides.md @@ -33,4 +33,53 @@ Slide 5: **Modify the urls.py** -- Modify the urls.py file located in the ```blog``` directory +- Modify the urls.py file located in the ```myproject``` folder + + # /myproject/urls.py + from django.conf.urls import include, url + from django.contrib import admin + from blog import views + from django.contrib.auth import views as auth_views # Add this import + + + urlpatterns = [ + url(r'^admin/', admin.site.urls), + url(r'^blogs/$', include('blogs.urls')), + url(r'^login/$', auth_views.login, {'template_name': 'login.html'}), # Add this line + ] + +Slide 6: +------------------ + +**Create a new template** + +Create a template login.html at /blog/templates/blog/login.html to look like below + +- Create a template ```login.html``` at ```/blog/templates/blog/login.html``` to look like below + + <html> + <body> + <form method="post" action="{% url 'django.contrib.auth.views.login' %}"> + {% csrf_token %} + <p class="bs-component"> + <table> + <tr> + <td>{{ form.username.label_tag }}</td> + <td>{{ form.username }}</td> + </tr> + <tr> + <td>{{ form.password.label_tag }}</td> + <td>{{ form.password }}</td> + </tr> + </table> + </p> + <p class="bs-component"> + <center> + <input class="btn btn-success btn-sm" type="submit" value="login" /> + </center> + </p> + <input type="hidden" name="next" value="{{ next }}" /> + </form> + </body> + </html> + |