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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:50:51+00:00 2026-06-17T16:50:51+00:00

I finished reading the documentation for the reverse() method of the Django URL dispatcher.

  • 0

I finished reading the documentation for the reverse() method of the Django URL dispatcher.

When is it useful?

Thank you!

  • 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-17T16:50:53+00:00Added an answer on June 17, 2026 at 4:50 pm

    The function supports the dry principle – ensuring that you don’t hard code urls throughout your app. A url should be defined in one place, and only one place – your url conf. After that you’re really just referencing that info.

    Use reverse() to give you the url of a page, given either the path to the view, or the page_name parameter from your url conf. You would use it in cases where it doesn’t make sense to do it in the template with {% url 'my-page' %}.

    There are lots of possible places you might use this functionality. One place I’ve found I use it is when redirecting users in a view (often after the successful processing of a form)-

    return HttpResponseRedirect(reverse('thanks-we-got-your-form-page'))
    

    You might also use it when writing template tags.

    Another time I used reverse() was with model inheritance. I had a ListView on a parent model, but wanted to get from any one of those parent objects to the DetailView of it’s associated child object. I attached a get__child_url() function to the parent which identified the existence of a child and returned the url of it’s DetailView using reverse().

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

Sidebar

Related Questions

I just finished reading some of the cocos2d documentation, and as far as I
I'm reading the Symfony documentation (Practical Symfony), and I finished creating the SQL code
I finished reading ( url in Built-in template tags and filters ). When are
Just finished reading this blog post: http://www.skorks.com/2010/03/an-interview-question-that-prints-out-its-own-source-code-in-ruby/ In it, the author argues the case
Just finished reading Jon Skeet's article about events and delegates and got a question.
I just finished reading the HTML5 Developer's Cookbook and have a question. I've read
I just finished reading about scoping in the R intro , and am very
Reading PayPal developer documentation (and this is a lot of documentation) I'm not sure
I've just finished reading Roy Osherove's The Art of Unit Testing and I am
I just finished reading the Functions chapter from Uncle Bob's Clean Code . 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.