Yes, I've found the code reuse to be a difficult sometimes because of
the naive thinking one view becomes one template. There needs to be a
way to flick a switch and render_to_response no longer return a
HttpResponse, but instead a dictionary of the context. Unless you make
all your views take a bool as the last argument that defaults to false
and then end the view with an if statement that tests this variable
and, if true just returns the context and if false returns a
HttpResponse. (I'm suddenly wishing python had macros)
You could:
1. Split your views into a view and a conventional function, where the
blog and poll views just call the function and the mashup calls both.
<-- This is easiest.
2. Make a custom tag. <-- People who do this say it's "worth it".
3. Just write the same code more than once, leaving yourself open to
all the problems that come with this <-- (HINT: don't do this one)
Yeah, I think that there may be improvements to be made in this area,
but with any framework you're going to find that it comes with some
limitations in a its simplistic views (no pun intended).
Good luck,
Frankie.
On 21/06/06, hubritic <[EMAIL PROTECTED]> wrote:
>
> Thanks!
>
> >From the doc:
> include
>
> Loads a template and renders it with the current context. This is a way
> of "including" other templates within a template.
>
>
> The key is the *with current context* bit ...
>
>
> Julio Nobrega wrote:
> > {% include 'file.html' %}
> >
> > http://www.djangoproject.com/documentation/templates/#include ?
> >
> >
> > On 6/21/06, hubritic <[EMAIL PROTECTED]> wrote:
> > >
> > > I haven't seen this addressed in the documentation ... Say I want to
> > > have a poll on how self-indulgent my blog post is. What I see in the
> > > tutorial shows how to make use a poll template and how to use a blog
> > > template, but I don't see how to use them both on the same page.
> > >
> >
> > --
> > Julio Nobrega - http://www.inerciasensorial.com.br
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---