# Using Django Auth Forms for Login Page

**URL:** <https://forum.djangoproject.com/t/using-django-auth-forms-for-login-page/734>\
**Category:** Using Django\
**Created:** [December 30, 2019, 12:01am UTC](https://forum.djangoproject.com/t/using-django-auth-forms-for-login-page/734 "2019-12-30T00:01:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bookieFreeTime](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@bookieFreeTime](https://forum.djangoproject.com/u/bookieFreeTime)\
**Post date:** [December 30, 2019, 12:01am UTC](https://forum.djangoproject.com/t/using-django-auth-forms-for-login-page/734/1 "2019-12-30T00:01:20Z")

</div>

Total Django Newbie here,

I am using Django CMS, which has a very quiet community, to set up a Django site that needs a login page for its users.

I have tried to use. I have found numerous tutorials, many of which are pre-3.0, and in referencing Django’s documentation on setting up a Template with the [Django default login forms](https://docs.djangoproject.com/en/3.0/topics/auth/default/#django.contrib.auth.views.LoginView). I have a login.html that can be used without any errors, but the table meant to show the login forms is empty making logging in not possible (the button appears):

> ```
> <form method="post" action="{% url 'login' %}">
> {% csrf_token %}
> <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>
> 
> ```

I am probably missing something really simple here. The urls.py appears to be set correctly with no errors:

> # -_- coding: utf-8 -_-
> 
> from **future** import absolute\_import, print\_function, unicode\_literals
> 
> from cms.sitemaps import CMSSitemap  
> from django.conf import settings  
> from django.conf.urls import include, url  
> from django.conf.urls.i18n import i18n\_patterns  
> from django.contrib import admin  
> from django.contrib.sitemaps.views import sitemap  
> from django.contrib.staticfiles.urls import staticfiles\_urlpatterns  
> from django.views.static import serve  
> from django.contrib.auth import views as auth\_views  
> from django.urls import path, include #From [https://wsvincent.com/django-user-authentication-tutorial-login-and-logout/](https://wsvincent.com/django-user-authentication-tutorial-login-and-logout/)
> 
> admin.autodiscover()
> 
> urlpatterns = [  
> url(r’^sitemap.xml$', sitemap,  
> {‘sitemaps’: {‘cmspages’: CMSSitemap}}),  
> ]
> 
> urlpatterns = [  
> url(‘admin/’, admin.site.urls),  
> url(‘accounts/’, include(‘django.contrib.auth.urls’)),  
> url(r’^', include(‘cms.urls’)), #This is added seperately  
> ]

Its my understanding that the Auth Forms don’t need to be imported deliberately and are part of the default Django install.

Hopefully someone can point out a simple mistake.

---

<div class="post-metadata">

**Author:** ![carltongibson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/carltongibson/32/267_2.png) [@carltongibson](https://forum.djangoproject.com/u/carltongibson)\
**Post date:** [December 31, 2019, 8:07am UTC](https://forum.djangoproject.com/t/using-django-auth-forms-for-login-page/734/2 "2019-12-31T08:07:02Z")

</div>

I’d guess that `form` Is not making it to your template’s context. Go back to your view and make sure you’re passing it to the template. Use Django Debug Toolbar or the debug tag to make sure the form is present. HTH.
