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 9002953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:38:39+00:00 2026-06-16T00:38:39+00:00

In my form.py I’m getting the following error (below) is there anything I have

  • 0

In my form.py I’m getting the following error (below) is there anything I have missed that could be explained to me? All I’m trying to do it clean/validate the confirm password field

This is the error:

KeyError at /member/registration/
'passwordConfirm'

response = callback(request, *callback_args, **callback_kwargs)

Users/user/Documents/workspace/project/member/forms.py in clean_password, line 27

forms.py

def clean_password(self):
    password = self.cleaned_data['password']
    passwordConfirm = self.cleaned_data['passwordConfirm']
    if password != passwordConfirm:
        raise forms.ValidationError("Password does not match, try again.")
    return password
    strong text

models.py

from django.db import models
from django.db.models.signals import post_save
from django.contrib.auth.models import User


class Member (models.Model):
    user =  models.OneToOneField(User)
    name = models.CharField(max_length=100)

    def __unicode__(self):
        return self.name

def createUserCallBacks(sender, instance, **kwargs):
    member, new = Member.objects.get_or_create(user=instance)
post_save.connect(createUserCallBacks, User)

view.py

def registration(request):
    if request.user.is_authenticated():
        return HttpResponseRedirect('/error')
    if request.method == 'POST':
        form = RegistrationForm(request.POST)
        if form.is_valid():
            user = User.objects.create_user(username=form.cleaned_data['username'],email=form.cleaned_data['email'], password=form.changed_data['password'])
            user.save()
            member = User.get_profile()
            member.name = form.cleaned_data['name']
            member.save()
            return HttpResponseRedirect('/profile')
        else:
            return render_to_response('pageRegistration.html', {'form':form},context_instance=RequestContext(request))

    else: 
        form = RegistrationForm 
        context = {'form':form}
        return render_to_response('pageRegistration.html', context, context_instance=RequestContext(request))
  • 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-16T00:38:40+00:00Added an answer on June 16, 2026 at 12:38 am

    If you want to check form for two fields you should do that in clean() method rather than individual fields clean method.

    Problem that you are seeing is, while you are in clean_password method, cleaned_data do not contain value for 'passwordConfirm'. i.e its clean method – clean_passwordConfirm() is not called yet.

    Documentation at Cleaning and validating fields that depend on each other

    Sample code:

    def clean(self):
        try:
            cleaned_data = super(RegistrationForm, self).clean()
            password = cleaned_data['password']
            passwordConfirm = cleaned_data['passwordConfirm']
            if password != passwordConfirm:
                raise forms.ValidationError("Password does not match, try again.")
            return cleaned_data
        except:
            raise forms.ValidationError("Password does not match, try again.")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Form Build your own MVVM I have the following code that lets us have
Form is made from a function that prints out all rows that are awaiting
I have a text area in my form which accepts all possible characters from
Form contains two dropdown lists created using code below. Both dropdown list elements have
Windows form application(.Net 3.5) I have a textbox and a button on the form.
Form setup: QSplitter (highlighted on the image) that contains QTreeWidget (left) and QTableWidget (right):
my form consists of following elements: icefaces text field to enter search criteria. icefaces
Form last 2 days i am trying to fix a issue of uploading a
$('form').each(function(){ var form = this; $('a', this).click(function(){ form.submit(); }); }); Is there any way
form that causes the problem: <%= form_for Like.find(post.user.likes), :html => { :method => :delete

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.