Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Hour 4. Creating the Initial Views > Using the Expression Values in the View

Using the Expression Values in the View

After you have added an expression to a pattern in the URLconf file, you can pass it to the view function as an argument. This allows you to use passed arguments to define the behavior of the view instead of having to access data from GET and POST data. The result is that your URLs have a much more elegant design than if you used PHP or CGI scripts.

By the Way

The values of expressions that Django passes as arguments to the view function are string format even if the pattern specifies digits using \d. If you need to use those values as a number, you must convert them first.



  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint