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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:08:57+00:00 2026-05-23T12:08:57+00:00

If the success_url is determined by the model, we can customize the generic view

  • 0

If the success_url is determined by the model, we can customize the generic view as below.

def get_success_url(self):
    return '/object/%s' % (self.object.id)

But if the success_url is irrelevant with the model, such as, we want to return to the page before we entered the form page. It can be a detail page, a list page, or anything else. Can I store the referral url in the form? Any idea is appreciated.

~Hanson

  • 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-23T12:08:58+00:00Added an answer on May 23, 2026 at 12:08 pm

    I assume that the success page will not always be the same as otherwise you could just include the url with something like reverse() in get_success_url.
    For a dynamic redirect you could either, like you suggested add the url in a hidden input to the form or in the querystring of the url the form is posted to (eg. /myurl?next=/redirect-url/). Then you could do in your view class something like:

    # url is in the form in a hidden input 'next'
    def get_success_url(self):
        return request.POST['next']
    
    # url is in the query string ?next=xxxx
    def get_success_url(self):
        return request.GET['next']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my urls.py I need to invoke a generic CreateView that requires a success_url
I am trying to set the success_url on a django class based UpdateView but
Will [NSData dataWithContentsOfURL:url] either return the full amount of bytes on success, or nil
I have a partial view which has dual list boxes and four buttons; exactly
Overflowers': I'm using Zend, and doing an Ajax post to a controller. I can
I am using a star rating plugin with ExtJS that is working well, but
The urlconf and view is as follows: url(r'^register/$', register, { 'backend': 'registration.backends.default.DefaultBackend' }, name='registration_register'),
I am new to struts and spring security. Can anyone help me to figure
Below is the code so far that I am working on, It will be
I have used GTMOAuth to successfully login to dropbox but i dont seem to

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.