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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:34:07+00:00 2026-05-16T14:34:07+00:00

I have a view that validates and saves a form. After the form is

  • 0

I have a view that validates and saves a form. After the form is saved, I’d like redirect back to a list_object view with a success message "form for customer xyz was successfully updated…"

HttpResponseRedirect doesn’t seem like it would work, because it only has an argument for the url, no way to pass dictionary with it.

I’ve tried modifying my wrapper for object_list to take a dict as a parameter that has the necessary context. I the return a call to this wrapper from inside the view that saves the form. However, when the page is rendered, the url is ‘/customer_form/’ rather than ‘/list_customers/’. I tried modifying the request object, before passing it to the object_list wrapper, but that did not work.

Thanks.

  • 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-16T14:34:08+00:00Added an answer on May 16, 2026 at 2:34 pm

    Please note the answer suggested here is only applicable to Django < 1.2:

    Do you have control over the view that you are redirecting to? In that case you can save the context in the session before redirecting. The target view can pick up the context (and delete it) from the session and use it to render the template.

    If your only requirement is to display a message then there is a better way to do this. Your first view can create a message for the current using auth and have the second view read and delete it. Something like this:

    def save_form(request, *args, **kwargs):
        # all goes well
        message = _("form for customer xyz was successfully updated...")
        request.user.message_set.create(message = message)
        return redirect('list_view')
    
    def list_view(request, *args, **kwargs):
        # Render page
    
    # Template for list_view:
    {% for message in messages %}
       ... 
    {% endfor %}
    

    Messages are saved to the database. This means that you can access them even after a redirect. They are automatically read and deleted on rendering the template. You will have to use RequestContext for this to work.

    For Django => 1.2 read the answer involving messages

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

Sidebar

Related Questions

I have a View that is basically setup like this: <Grid> <ViewBox> <Grid> <ItemsControl
I have a form that is added through the nodeapi displayed only on view
I have a view which validates data from a form which just has some
I am beginner in rails. I have view that i try to print inside
I have a view that has a column to make it sortable. When clicking
I have a view that renders a list elements using the following template :
I have a view that shows user profile fields in a tabular format. There
I have a view that is used in a UINavigationController and and is automatically
I have a View that contains a ParentModel, which contains 2 Models. I only
I have a view that has a tooltip attribute. I want to set that

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.