Re: Avoiding code repetition in views

2012-06-29 Thread Melvyn Sopacua
On 29-6-2012 5:45, Ryan Nowakowski wrote: > Or a custom template context processor that adds gigs to every request > context. Or just use an iframe in your template that loads the gigs rendering view. Iframe bad, yes, and all that, but the simplest solution in this case if your layout can handle i

Re: Avoiding code repetition in views

2012-06-29 Thread Timothy Makobu
@grimmus I have a file called shared.py, and In it, i have created a dict template_dict { } which has stuff that all the views share. I import it into views.py and any app that will use that dict. I can then add more items or alter existing ones via template_dict.update(). On Fri, Jun 29, 2012 a

Re: Avoiding code repetition in views

2012-06-28 Thread kenneth gonsalves
On Fri, 2012-06-29 at 01:07 +0200, Christophe Pettus wrote: > > I hope i have been clear > > I'm going to take a guess and surmise that you have a lot of different > view functions, each one of which needs to pass a list of gigs into > the context for the template and then render that page, and yo

Re: Avoiding code repetition in views

2012-06-28 Thread Ryan Nowakowski
Or a custom template context processor that adds gigs to every request context. On Thu, Jun 28, 2012 at 10:40:30PM -0400, J. Cliff Dyer wrote: > It looks like what you want to do is create a templatetag. Then you can > just include a snippet like: {% gig_schedule %} in your template. The > docum

Re: Avoiding code repetition in views

2012-06-28 Thread J. Cliff Dyer
It looks like what you want to do is create a templatetag. Then you can just include a snippet like: {% gig_schedule %} in your template. The documentation can point you in the right direction. On Thu, 2012-06-28 at 15:20 -0700, grimmus wrote: > Hi, > > > I am doing a site for a DJ that lists

Re: Avoiding code repetition in views

2012-06-28 Thread David Lam
On Jun 28, 2012, at 3:20 PM, grimmus 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 th

Re: Avoiding code repetition in views

2012-06-28 Thread Christophe Pettus
On Jun 29, 2012, at 12:20 AM, grimmus wrote: > 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 i

Re: Avoiding code repetition in views

2012-06-28 Thread Aaron C. de Bruyn
On Thu, Jun 28, 2012 at 3:20 PM, grimmus wrote: > I am wondering how i can pass the gig information to every page without > having to repeat the code in every page view. > > I hope i have been clear Not really. We can't guess what you're doing. :) Paste a sample of the code you're referring to

Avoiding code repetition in views

2012-06-28 Thread grimmus
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. I hope i have been clear Thanks