login
Holden Web
What you'll need to know tomorrow

Comments on Starting to Understand Django

Why did you go through manual HttpResponse, get_te...

Unknown · 2007-12-30T17:52:00

Why did you go through manual HttpResponse, get_template and render instead of using the render_to_response helper?

I just posted a snapshot of the code in developmen...

Steve · 2007-12-30T19:11:00

I just posted a snapshot of the code in development. I suppose technically I should also have wrapped the hpdict as a Context, but ignorance was bliss ;-)

Steve, I almost never wrap the dictionary in a co...

Anonymous · 2007-12-30T23:41:00

Steve,

I almost never wrap the dictionary in a context object. Using django.shortcuts.render_to_response, you can just do:

render_to_response("homepage.html", hpdict)

As you get into django more, you'll start to realize that there is more than one way to skin your cat, and then there are also ways to skin parrots, dogs, orangatans and fruitbats. It's a large animal, and you won't get in all in the first swoop.

Welcome to Django!

Thanks, Paul. I am still wondering what the advant...

Steve · 2007-12-31T02:00:00

Thanks, Paul. I am still wondering what the advantage of a Context is over a dictionary for rendering templates. I guess the real advantages become more obvious when you start to add things like defaulting behaviors in subclasses such as Django's Request.Context.

I have been pleasantly surprised so far at how simple Django makes it to render the site—I have already got the home page completed, and am looking at a couple of performance optimizations in the client-side scripting before approaching generation of the body pages.

Obviously there will be mistakes on the way up the learning curve, and the jury is still out on whether it will be advantageous to move away from an almost entirely static site like holdenweb.com is today.

Further note: though I am not yet much further int...

Steve · 2008-01-02T16:13:00

Further note: though I am not yet much further into Contexts one aspect I have only just become aware of is their stacking abilities. This allows them to act like the nested namespaces we are used to dealing with in Python, and while I haven't yet made use of the feature I can see it will be useful in certain circumstances.

Page 1 of 1

Back to post