Book Image

Django 1.0 Template Development

Book Image

Django 1.0 Template Development

Overview of this book

Table of Contents (17 chapters)
Django 1.0 Template Development
Credits
About the Author
About the Reviewers
Preface
Index

Setting up our example


In Chapter 2, we worked with the Press Release application, configuring it to work with both regular and generic views. Let's continue to use this application and modify it to serve data in a few different formats. Also, at the end of Chapter 2 we set up our application to serve the detail page with a generic view, saving us from having to write a view to serve the detail of a press release.

Because we want to customize the output of our detail page based on the presence of a variable in the URL, we're going to use our view function again instead of the generic view. If you didn't delete it, the view function should still be in your mycompany/press/views.py file. (It's included below in case you deleted it.)

Edit your mycompany/press/urls.py file, removing the generic view for the press release detail page and inserting the highlighted line as shown:

urlpatterns = patterns('',
    (r'detail/(?P<pid>\d+)/$',
        'mycompany.press.views.detail'), 
    (r'list/...