# Unable to add a user using Django Forms

**URL:** <https://forum.djangoproject.com/t/unable-to-add-a-user-using-django-forms/6047>\
**Category:** Using Django\
**Created:** [January 9, 2021, 7:53am UTC](https://forum.djangoproject.com/t/unable-to-add-a-user-using-django-forms/6047 "2021-01-09T07:53:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arshtamboli](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/arshtamboli/32/3067_2.png) [@arshtamboli](https://forum.djangoproject.com/u/arshtamboli)\
**Post date:** [January 9, 2021, 7:53am UTC](https://forum.djangoproject.com/t/unable-to-add-a-user-using-django-forms/6047/1 "2021-01-09T07:53:24Z")

</div>

\*)This is register.html

{% extends ‘base.html’ %}  
{% block title %} Register {% endblock title %}  
{% block body %}

 {% csrf\_token %} {{form.as\_p}} {% endblock body %}

\*)views.py file  
from django.shortcuts import render,HttpResponse  
from django.contrib.auth.forms import UserCreationForm  
def register(request):  
form=UserCreationForm()  
if request.method==‘POST’:  
regForm=UserCreationForm(request.POST)  
if regForm.is\_valid():  
regForm.save()  
return render(request,‘register.html’,{‘form’:form})

\*)urls.py  
from django.urls import path, include

from app1 import views

urlpatterns = [  
path(’’, views.index, name=‘index’),  
path(“register”, views.register, name=‘register’),  
]

---

<div class="post-metadata">

**Author:** ![atcrank](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/atcrank/32/2029_2.png) [@atcrank](https://forum.djangoproject.com/u/atcrank)\
**Post date:** [January 10, 2021, 12:18am UTC](https://forum.djangoproject.com/t/unable-to-add-a-user-using-django-forms/6047/2 "2021-01-10T00:18:06Z")

</div>

You don’t describe the problem, but I see at least one problem that you don’t have ‘form’ tags in your template or a ‘submit’ button.

From the [docs](https://docs.djangoproject.com/en/3.1/topics/forms/#building-a-form):  
`<form action="/your-name/" method="post">`  
` <label for="your_name">Your name: </label>`  
` <input id="your_name" type="text" name="your_name" value="{{ current_name }}">`  
` <input type="submit" value="OK">`  
`</form>`

---

<div class="post-metadata">

**Author:** ![arshtamboli](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/arshtamboli/32/3067_2.png) [@arshtamboli](https://forum.djangoproject.com/u/arshtamboli)\
**Post date:** [January 11, 2021, 9:34am UTC](https://forum.djangoproject.com/t/unable-to-add-a-user-using-django-forms/6047/3 "2021-01-11T09:34:08Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/8/8add2e44259dbdae88572355f9e916321fbd785e.png)  
Well this is our register form. Don’t know why previously I copy pasted it here for asking question, the form tag was missing. Now I still copy paste the code but again it is ignoring completely the form tag, so I screen shot and paste it. This is how my register.html looks like.

---

<div class="post-metadata">

**Author:** ![arshtamboli](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/arshtamboli/32/3067_2.png) [@arshtamboli](https://forum.djangoproject.com/u/arshtamboli)\
**Post date:** [January 11, 2021, 9:42am UTC](https://forum.djangoproject.com/t/unable-to-add-a-user-using-django-forms/6047/4 "2021-01-11T09:42:17Z")

</div>

Everything is working well, register form. But when I create user from register form and submit it then I can’t see the user in the admin panel.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/9/9008aa281779e2b6a6b219464b0d6773ee307463.png)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 11, 2021, 1:07pm UTC](https://forum.djangoproject.com/t/unable-to-add-a-user-using-django-forms/6047/5 "2021-01-11T13:07:00Z")

</div>

This forum does some auto-formatting of “unfenced” text.

When you paste code, templates, or html text here to the forum, enclose it between lines of three backtick - ` characters.

Example:

````auto
# The line above this is ```
def function(self):
    return self
# The line after this is ```

````

Please don’t post screen shots for code. They’re not readable on every device and they can’t be quoted for detailed explanations.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 11, 2021, 1:15pm UTC](https://forum.djangoproject.com/t/unable-to-add-a-user-using-django-forms/6047/6 "2021-01-11T13:15:08Z")

</div>

You’re not handling any potential errors in your code. If regForm is _not_ valid, you’re not doing anything to see what those errors might be, so you don’t _know_ that your form is working.

See [How errors are displayed](https://docs.djangoproject.com/en/3.1/ref/forms/api/#how-errors-are-displayed), [More granular output](https://docs.djangoproject.com/en/3.1/ref/forms/api/#more-granular-output), and for even more details, [Form and field validation](https://docs.djangoproject.com/en/3.1/ref/forms/validation/#form-and-field-validation)

---

<div class="post-metadata">

**Author:** ![arshtamboli](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/arshtamboli/32/3067_2.png) [@arshtamboli](https://forum.djangoproject.com/u/arshtamboli)\
**Post date:** [January 13, 2021, 10:01am UTC](https://forum.djangoproject.com/t/unable-to-add-a-user-using-django-forms/6047/7 "2021-01-13T10:01:26Z")

</div>

Well I stopped this project and created new project from scratch now everything is working Good.  
Thanks for reply
