Thursday, June 28, 2012

Re: Avoiding code repetition in views

On Jun 28, 2012, at 3:20 PM, grimmus <graham.colmer@gmail.com> wrote:

> Hi,
>
> I am doing a site for a DJ that lists upcoming gigs on each page. There's an include file in each page template to output the list of gigs.
>
> I am wondering how i can pass the gig information to every page without having to repeat the code in every page view.

Maybe an inclusion tag?

{% get_list_of_cool_gigs page %}

e.g. output the list of gigs for a given argument, the page

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment