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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:03:02+00:00 2026-05-22T19:03:02+00:00

From looking over the documentation, it seems that the form clean() method is only

  • 0

From looking over the documentation, it seems that the form clean() method is only intended to do lightweight syntax-related validation, such as checking that an email address ends in “.com” or “.edu”, or ensuring that the user selects no more than three items from a “pick your top three favorite TV shows” list.

I’m working on an application that allows users to set their password and I want to make sure that their password doesn’t contain their login or their real name, and the clean() method doesn’t seem like the right place to do this kind of checking, both from a design standpoint and also from the practical limitation that the clean() method doesn’t have access to the session data.

Where is the best place to do more heavyweight validation? If I do some custom checking in the view after calling form.is_valid(), is there a way to get back to the standard form error handling?

I have an idea the code might look like this:

def process_login(request):
    """Display or process the login form."""

    if request.method == 'POST':
        form = LoginForm(request.POST)

        if form.is_valid():
            password = form.cleaned_data['password']
            if password_is_bad(password, request):
                # what now?
  • 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-05-22T19:03:02+00:00Added an answer on May 22, 2026 at 7:03 pm

    There’re field-specific validation hooks too: clean_$fieldname. See details in this section of django docs.

    Update: As for passing session info to form, this is easily done via attribute assignment:

    form = LoginForm(request.POST)
    form.session = request.session
    

    then you can access self.session in clean_password method.

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

Sidebar

Related Questions

I'm looking for some feedback from anyone that has had a chance to spend
I just switched over from iPhone to Android and am looking for something similar
I was looking over the js source code for Scrabb.ly . I've noticed that
We're looking at moving from a check-out/edit/check-in style of version control system to Subversion,
We are looking at moving from Visual Studio 2008 Professional to Visual Studio Team
I am looking to display an array from 128 to 512 bytes in size
We're looking at upgrading from Visual Studio 2005 to Visual Studio 2008. I discovered
I'm looking at maybe moving from an older AMD64 to a new Intel dual-core
I am looking at the EAGLView files from the apple iphone sample code and
I was looking at this article from 2005 and wanted to get some thoughts

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.