Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7822063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:49:17+00:00 2026-06-02T07:49:17+00:00

when ever i fill the form and submit nothing is added to the database

  • 0

when ever i fill the form and submit nothing is added to the database instead it reloads the page with empty passwords field and even if the form contains password not equal to Verifypassword ValidationError doesnot appear ….thank u

forms.py

class SignUpForm(ModelForm):
    username      = forms.CharField(label=(u'Username'))
    first_name    = forms.CharField(label=(u'First name'))
    last_name     = forms.CharField(label=(u'Last name'))
    address       = forms.CharField(label=(u'Address'))
    email         = forms.EmailField(label=(u'Email Address'))
    password      = forms.CharField(label=(u'Password'),widget=forms.PasswordInput(render_value=False))
    password1     = forms.CharField(label=(u'Verify Password'),widget=forms.PasswordInput(render_value=False))
    mobile        = forms.IntegerField(label=(u'Mobile'))

    class Meta:
        model = Employer
        ## check whats Exclude !!!!
        exclude = ('user',)

def clean_username(self):
        username = self.cleaned_data['username']
        try:
            User.objects.get(username=username)
        except User.DoesNotExist:
            return username

            raise forms.ValidationError("That username  already exists. Please select another")

def clean(self):
        if self.cleaned_data['password'] != self.cleaned_data['password1']:
            raise forms.ValidationError("not matched")
        return self.cleaned_data

view.py

def EmployerRegistration(request):
    if request.user.is_authenticated():
        return HttpResponseRedirect('/profile/')
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            employer =Employer.objects.create(username=form.cleaned_data["username"],password= form.cleaned_data['password'],first_name=form.cleaned_data['first_name'],last_name=form.cleaned_data['last_name'],email=form.cleaned_data['email'],address=form.cleaned_data['address'],mobile=form.cleaned_data['mobile'])
            employer.save()
            return HttpResponseRedirect('/login/')  



        else:
                return render_to_response('Sign_up_Employer.html',{'form':form}, context_instance=RequestContext(request))


    else:
    #user is not submitting show them the registeration form
            form= SignUpForm()
            context = {'form':form}
            return render_to_response('Sign_up_Employer.html',context,context_instance=RequestContext(request))

Sign_Up_Employer.html

{%block content%}
<form action ="" method ="post">
{% csrf_token %}
{% if form.errors %}<p>Please Correct </p> {% endif %}
<div class ="register_div">
{%if form.username.errors%}<p class= "error">{{form.username.errors}}</p>{% endif %}
 <p> <label for ="username"{% if form.username.errors %} class= "error"{% endif %}> Username</label></p>
<p>{{form.username}}</p>
 </div>
 <div class ="register_div">
{%if form.first_name.errors%}<p class= "error">{{form.first_name.errors}}</p>{% endif %}
 <p> <label for ="first_name"{% if form.first_name.errors %} class= "error"{%endif%}>First name</label></p>
<p>{{form.first_name}}</p>
 </div>
 <div class ="register_div">
{%if form.last_name.errors%}<p class= "error">{{form.last_name.errors}}</p>{% endif %}
 <p> <label for ="last_name"{% if form.last_name.errors %} class= "error"{%endif%}>Last name</label></p>
<p>{{form.last_name}}</p>
 </div>
<div class ="register_div">
{%if form.address.errors%}<p class= "error">{{form.address.errors}}</p>{% endif %}
 <p> <label for ="address"{% if form.address.errors %} class= "error"{%endif%}>Address'</label></p>
<p>{{form.address}}</p>
 </div>
 <div class ="register_div">
{%if form.email.errors%}<p class= "error">{{form.email.errors}}</p>{% endif %}
 <p> <label for ="email"{% if form.email.errors %} class= "error"{%endif%}>Email Address</label></p>
<p>{{form.email}}</p>
 </div>
 <div class ="register_div">
{%if form.password.errors%}<p class= "error">{{form.password.errors}}</p>{% endif %}
 <p> <label for ="password"{% if form.password.errors %} class= "error"{%endif%}>Password</label></p>
<p>{{form.password}}</p>
 </div>

 <div class ="register_div">
{%if form.password1.errors%}<p class= "error">{{form.password1.errors}}</p>{% endif %}
 <p> <label for ="password1"{% if form.password1.errors %} class= "error"{%endif%}>Verify Password</label></p>
<p>{{form.password1}}</p>
 </div>

 <div class ="register_div">
{%if form.mobile.errors%}<p class= "error">{{form.mobile.errors}}</p>{% endif %}
 <p> <label for ="mobile"{% if form.mobile.errors %} class= "error"{%endif%}>Mobile</label></p>
<p>{{form.mobile}}</p>
 </div>
 <p><input type =submit alt =register></p>
</form>
{% endblock %}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:49:18+00:00Added an answer on June 2, 2026 at 7:49 am

    I can’t tell if this is just a cut-and-paste problem (although since it was the same in your other (deleted) question, I’m inclined to think not), but the indentation for your two clean methods is wrong. They’re not currently part of the ModelForm class at all, so will not be called. Indent them one level, so they are at the same level as class Meta.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

dumbest question ever... but I want to somehow fill 'gid' value in data load
I have a main page where you fill in some data. After you click
Has anyone ever made a sharepoint lookup column that allows fill inn choices and
I am trying to dynamically fill a second panorama page based on what item
I have a TreeView in my Windows Form user interface. I want to fill
I want to make a dynamic filling list that fill the screen what ever
On my app I've got a Database which i have to fill one time
I have a zend form that lets the user fill out attributes of an
I have a database of events that are used to fill a PHP calender.
Ever since I upgraded to Delphi 2009, I am having terrible experience with TFrame

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.