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

  • Home
  • SEARCH
  • 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 5970489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:22:52+00:00 2026-05-22T20:22:52+00:00

How shall I return to my page after a django form has failed validation?

  • 0

How shall I return to my page after a django form has failed validation?

This is what I have at the moment, I return a render_to_response after it has failed with my form objects and all the other objects I need to pass back in. But The url in the browser has the value of the form action and so this seems to me as if I’m doing something wrong. I would prefer if I could somehow return the objects along with a HttpResponseRedirect but looking at the docs that is not possible.

def addReview(request,reviewId):
    review = AdminReview.objects.get(id=int(reviewId))

if request.method == 'POST':
    form = UserReviewForm(request.POST)
    if form.is_valid():
        cd = form.cleaned_data
        ur = UserReview(adminReview=review,review=cd['review'],rating=int(cd['rating']))
        ur.save()          
        return HttpResponseRedirect(reverse('filmflux.reviews.views.review', kwargs={'reviewId':review.id,'filmSlug':review.filmSlug}))
userReviews = review.userreview_set.all()
return render_to_response('review.html', {'review':review,'form': form, 'userReviews': userReviews }, 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-05-22T20:22:53+00:00Added an answer on May 22, 2026 at 8:22 pm

    Sessions would be good for this, or if you use AJAX you can validate the form, then return your object or some sort of error message or whatever you want after a failure. One or the other would probably be best. You could also pass params from the POST request along as GET query params to the redirected view, or pass arguments to the redirected view:

    from django.shortcuts import redirect
    return redirect('some-view-name', reviewID=id)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a idea for a security. Our employees shall have access to some
Hopefully I'm just missing something and this is simple... I have a page that
No matter what I do this form won't behave via AJAX at all. There's
Hii All, Aardvark < Zoroaster # return true I think, this is very basic.
I have this bit of code: if ($('.page-template-default .gallery img').attr('alt') !== undefined) { $('.page-template-default
I have a canvas in Flex that shall be able only to be scrolled
For whatever reason, our company has a coding guideline that states: Each class shall
Shell (explorer.exe www.google.com) is how I'm currently opening my products ad page after successful
The PayPal API has what's commonly referred to as a Thank You page --
I have a .Net application that dynamically creates a small HTML page and pops

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.