Discussion:
error in creating modelform for builtin user table
(too old to reply)
shiva kumar
2018-11-28 17:44:15 UTC
Permalink
hello guys,
i want to create a register form that user builtin *user *table .
For that i used model form. here is code of forms.

*forms.py*

from django import forms
from .models import BlogPost
from django.conf import settings
from django.contrib.auth import get_user_model
User=get_user_model()
from django import forms


class register(forms.ModelForm):
class meta:

model=User
fields=['username','first_name','last_name','email','password'
]
password2 = forms.CharField(label='re-enter password', max_length=128)


and i used views.

*views.py*


def hidemeregister(request):
if request.method == 'POST':
form = register(request.POST)
if form.is_valid():
if form.cleaned_data['password']==form.cleaned_data['password2']:
form.save()
print(type(form))
return redirect('/hideme/blog/')
else:
form=register(get_user_model())
return render(request,'login.html',{'form':form})


and *login.html *

i simple used form.as_p in login.html


i am getting error like this


[image: image.png]



[image: image.png]


please figure out where is the error

here i am using builtin user for register.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@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/CAMsYeuHni67VsJBiWrC6w8seMFN0hpGrqQOJp1sAaSZGLtUHbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
amit pant
2018-11-30 13:24:00 UTC
Permalink
use variable instead of getusermodel
Post by shiva kumar
hello guys,
i want to create a register form that user builtin *user *table .
For that i used model form. here is code of forms.
*forms.py*
from django import forms
from .models import BlogPost
from django.conf import settings
from django.contrib.auth import get_user_model
User=get_user_model()
from django import forms
model=User
fields=['username','first_name','last_name','email','password'
]
password2 = forms.CharField(label='re-enter password', max_length=128)
and i used views.
*views.py*
form = register(request.POST)
form.save()
print(type(form))
return redirect('/hideme/blog/')
form=register(get_user_model())
return render(request,'login.html',{'form':form})
and *login.html *
i simple used form.as_p in login.html
i am getting error like this
[image: image.png]
[image: image.png]
please figure out where is the error
here i am using builtin user for register.
--
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
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/CAMsYeuHni67VsJBiWrC6w8seMFN0hpGrqQOJp1sAaSZGLtUHbQ%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAMsYeuHni67VsJBiWrC6w8seMFN0hpGrqQOJp1sAaSZGLtUHbQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@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/CAF2Ah_HxawKHpDRBeVn07XP2je8n8pVce5ukXMQ49Q3iaUrsNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Nagarjuna J
2018-11-30 13:30:01 UTC
Permalink
i think add password2 in form fileds
Post by amit pant
use variable instead of getusermodel
Post by shiva kumar
hello guys,
i want to create a register form that user builtin *user *table .
For that i used model form. here is code of forms.
*forms.py*
from django import forms
from .models import BlogPost
from django.conf import settings
from django.contrib.auth import get_user_model
User=get_user_model()
from django import forms
model=User
fields=['username','first_name','last_name','email','password'
]
password2 = forms.CharField(label='re-enter password', max_length=128)
and i used views.
*views.py*
form = register(request.POST)
form.save()
print(type(form))
return redirect('/hideme/blog/')
form=register(get_user_model())
return render(request,'login.html',{'form':form})
and *login.html *
i simple used form.as_p in login.html
i am getting error like this
[image: image.png]
[image: image.png]
please figure out where is the error
here i am using builtin user for register.
--
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
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/CAMsYeuHni67VsJBiWrC6w8seMFN0hpGrqQOJp1sAaSZGLtUHbQ%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAMsYeuHni67VsJBiWrC6w8seMFN0hpGrqQOJp1sAaSZGLtUHbQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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
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/CAF2Ah_HxawKHpDRBeVn07XP2je8n8pVce5ukXMQ49Q3iaUrsNw%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAF2Ah_HxawKHpDRBeVn07XP2je8n8pVce5ukXMQ49Q3iaUrsNw%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Thanks&Regards,
-------------------------
J.V.Nagarjuna Reddy,
7207203544,
8328031020.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@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/CADK%2B6-B9pdSS-wJj%3DtssFNY-Hc%2BF%3D13rSh9VqQZ2mnuV0s8A1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
shiva kumar
2018-11-30 13:47:48 UTC
Permalink
Ok thanks guys for ur reply .
But I had found solution.
Just place Meta at meta
Post by Nagarjuna J
i think add password2 in form fileds
Post by amit pant
use variable instead of getusermodel
Post by shiva kumar
hello guys,
i want to create a register form that user builtin *user *table
. For that i used model form. here is code of forms.
*forms.py*
from django import forms
from .models import BlogPost
from django.conf import settings
from django.contrib.auth import get_user_model
User=get_user_model()
from django import forms
model=User
fields=['username','first_name','last_name','email','password'
]
password2 = forms.CharField(label='re-enter password', max_length=128)
and i used views.
*views.py*
form = register(request.POST)
form.save()
print(type(form))
return redirect('/hideme/blog/')
form=register(get_user_model())
return render(request,'login.html',{'form':form})
and *login.html *
i simple used form.as_p in login.html
i am getting error like this
[image: image.png]
[image: image.png]
please figure out where is the error
here i am using builtin user for register.
--
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
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/CAMsYeuHni67VsJBiWrC6w8seMFN0hpGrqQOJp1sAaSZGLtUHbQ%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAMsYeuHni67VsJBiWrC6w8seMFN0hpGrqQOJp1sAaSZGLtUHbQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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
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/CAF2Ah_HxawKHpDRBeVn07XP2je8n8pVce5ukXMQ49Q3iaUrsNw%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAF2Ah_HxawKHpDRBeVn07XP2je8n8pVce5ukXMQ49Q3iaUrsNw%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Thanks&Regards,
-------------------------
J.V.Nagarjuna Reddy,
7207203544,
8328031020.
--
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
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/CADK%2B6-B9pdSS-wJj%3DtssFNY-Hc%2BF%3D13rSh9VqQZ2mnuV0s8A1A%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CADK%2B6-B9pdSS-wJj%3DtssFNY-Hc%2BF%3D13rSh9VqQZ2mnuV0s8A1A%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@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/CAMsYeuGmMJM5QMjtCrL8J%3DJsnoXTTpYKb2b2bbhj8kPOQJ8cEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
amit pant
2018-12-05 05:57:01 UTC
Permalink
yes, that was.
Post by shiva kumar
Ok thanks guys for ur reply .
But I had found solution.
Just place Meta at meta
Post by Nagarjuna J
i think add password2 in form fileds
Post by amit pant
use variable instead of getusermodel
Post by shiva kumar
hello guys,
i want to create a register form that user builtin *user *table
. For that i used model form. here is code of forms.
*forms.py*
from django import forms
from .models import BlogPost
from django.conf import settings
from django.contrib.auth import get_user_model
User=get_user_model()
from django import forms
model=User
fields=['username','first_name','last_name','email','password'
]
password2 = forms.CharField(label='re-enter password', max_length=128)
and i used views.
*views.py*
form = register(request.POST)
form.save()
print(type(form))
return redirect('/hideme/blog/')
form=register(get_user_model())
return render(request,'login.html',{'form':form})
and *login.html *
i simple used form.as_p in login.html
i am getting error like this
[image: image.png]
[image: image.png]
please figure out where is the error
here i am using builtin user for register.
--
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
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/CAMsYeuHni67VsJBiWrC6w8seMFN0hpGrqQOJp1sAaSZGLtUHbQ%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAMsYeuHni67VsJBiWrC6w8seMFN0hpGrqQOJp1sAaSZGLtUHbQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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
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/CAF2Ah_HxawKHpDRBeVn07XP2je8n8pVce5ukXMQ49Q3iaUrsNw%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAF2Ah_HxawKHpDRBeVn07XP2je8n8pVce5ukXMQ49Q3iaUrsNw%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Thanks&Regards,
-------------------------
J.V.Nagarjuna Reddy,
7207203544,
8328031020.
--
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
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/CADK%2B6-B9pdSS-wJj%3DtssFNY-Hc%2BF%3D13rSh9VqQZ2mnuV0s8A1A%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CADK%2B6-B9pdSS-wJj%3DtssFNY-Hc%2BF%3D13rSh9VqQZ2mnuV0s8A1A%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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
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/CAMsYeuGmMJM5QMjtCrL8J%3DJsnoXTTpYKb2b2bbhj8kPOQJ8cEg%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAMsYeuGmMJM5QMjtCrL8J%3DJsnoXTTpYKb2b2bbhj8kPOQJ8cEg%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@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/CAF2Ah_FPWotFgdhBNLrFxHRaGFSr-mgSO45GsNUvMqNv0EKoJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...