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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:12:57+00:00 2026-06-19T03:12:57+00:00

Which HttpResponse method will help me do this ? I have a form validation

  • 0

Which HttpResponse method will help me do this ? I have a form validation code in some view :

if request.method == 'POST'
    form = SomeForm(request.POST)
    if form.is_valid():
        form.save()

    else:
        return HttpResponseRedirect('back.to.this.view')
        # I want to redirect to the same form page with a small error message 
        #below the form saying "This is an empty form"

How do I add that message in the page ?

I am new to Django and web development

  • 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-19T03:12:58+00:00Added an answer on June 19, 2026 at 3:12 am

    This would be a strange thing to do.

    You don’t want to redirect back to the current view. What you want to do is redisplay the existing page, with the errors automatically generated by your call to form.is_valid(). You do this by following the example view in the documentation.

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

Sidebar

Related Questions

I'm writing some code in which I need to use my own HttpResponse object
We have the following code, which later on replaced with HttpHead method as we
I have a Django form which I'm validating in a normal Django view. I'm
I would like to have the following method which returns HttpResponse . But at
I have an included object's form: <form method=post class=object_form id=event-core-form action={% url save_event_core_data event.id
this is part of my code which reads an http response. It's supposed to
I have a submit button created in which I am calling a method call2
I've tried dir(), but the commands just return messages like this: <bound method HTTPResponse.begin
I have a code which has an activity with a button which when clicked
This method is used to consume a web service which I also control. The

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.