On 12/18/06, Crispin Bennett <[EMAIL PROTECTED]> wrote:
> I was primarily wondering whether there's a 'natural' Django idiom or
> pattern for doing this kind of thing. My first crude attempt is to
> have a method in the model that provides a predictable template name
> for the object. Then in my main template I include the relevant
> template for the object.  It works, but doesn't quite feel right.

It's not a particularly bad idea; having an object carry with it
standardized information which tells you what template to use to
display it would be pretty easy (assuming, of course, that you have
the ability to lay out the model classes to support that).

> Perhaps I should be using custom tags, or maybe I could do something
> more dynamic, removing the need to code specifically for each model
> altogether?

You could do that, by using introspection and making educated guesses
about which fields you want. Or you could try to standardize the
models up-front so that they'd all have a few common field names
(things like 'title', 'pub_date', etc.), so you'd end up doing less
introspection at runtime.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to