Tuesday, September 23, 2008

Django From the Ground Up: Episode 4

with host Eric Florenzano

Bookmark and Share

In this episode we cover a lot of ground: setting up our url configuration, writing a view to get all of the events for tonight, creating a base template, and extending that base template to render the results of the view that we wrote.

This is the Fun Part

Setting up the models is fun in its own way, but now we get to start crafting the site! How will the URLs for our site look? What information shows up on which page? How much information do we show? These are the questions that we get to answer (or at least begin to answer) in this step of the development process.

Comments - 9 people have already said something. Join the discussion.

  • Dave Parsons said

    Great series. The link for the Flash version is wrong. It should be: http://showmedo.com/videos/video?name=3360030&fromSeriesID=336

  • srinivasa.k.p said

    Learning Django

  • Antonius said

    Hi Eric,

    In the events view 'def tonight(request)' you said in this sc that context is a "legacy" term for you, what might I call it to better align with django's use of the word?

    context = {
    'events': events,
    }

  • Eric Florenzano said

    Antonius: Hmm, good question. I guess it's just a matter of personal preference. Mine's to use 'context' :)

  • Scot Hacker said

    Eric, these are great. Just wanted to say thanks.

    Quick TextMate tip: Rather than pasting in the doctype string from elsewhere, pull down File | New From Template | HTML and then choose the doctype you want.

  • Eric Florenzano said

    Scot Hacker: Thanks for the tip! I'll keep that in mind. (I usually only have to do it once per django project, though :) )

  • Phuture said

    Total newbie to django...

    I ran into a problem at this point with the tonight.html template not displaying any events even though there are events. All I get is a ':' with no username or description, so it appears that something is getting passed in but the event.creator.username and event.creator.description is not accessible.

    Everything else seems to be working correctly.. I ran though the tutorials again and checked all of my files.. I must be missing something but they seem to be okay.

    From the shell, Event.objects.today().filter(latest=True) returns

    [<Event: Testing our public view>]

    Not sure how to test for the creator stuff from here


  • Phuture said

    Nevermind....

    I found a typo in the template...

    Thanks for the great work!

  • gudaoxuri said

    can you speak chinese???