Re: very noob : DRY violation in views.py

2009-12-20 Thread Osiaq
Just one word: wow! Yes, definitely I'm gonna dig into it :) On Dec 20, 2:34 am, Ethan Jucovy wrote: > Lately I have really liked using custom template tags for these sorts of > queries. > > Once you get the hang of writing them, it's very quick to build a little > library of queries in custom t

Re: very noob : DRY violation in views.py

2009-12-19 Thread Ethan Jucovy
Lately I have really liked using custom template tags for these sorts of queries. Once you get the hang of writing them, it's very quick to build a little library of queries in custom tags for your application. These are *very* convenient to use because you don't have to modify views.py -- or any

Re: very noob : DRY violation in views.py

2009-12-19 Thread Osiaq
@Brian Thank you very much for clear explanation! I gives me much more than enormous pages of manuals. @Itay Thanks for suggestion, but refractoring inside views.py looks more clear to manage. I wasn't also sure, if such simple solution requires middleware involved. I will probably have more than

Re: very noob : DRY violation in views.py

2009-12-19 Thread Brian Victor
Osiaq wrote: > def services(request): > property = Property.objects.all().order_by('name')[:4] > city = City.objects.all() > category=PropertyCategory.objects.all() > status=PropertyStatus.objects.all() > return render_to_response('website/services.html',{'property': >

Re: very noob : DRY violation in views.py

2009-12-19 Thread Itay Donenhirsch
i'm quite a noob myself but my best guess is to use context processor, see http://stackoverflow.com/questions/557460/django-having-middleware-communicate-with-views-templates On Sat, Dec 19, 2009 at 8:14 PM, Osiaq wrote: > VIEWS: > > def services(request): >        property = Property.objects.

very noob : DRY violation in views.py

2009-12-19 Thread Osiaq
VIEWS: def services(request): property = Property.objects.all().order_by('name')[:4] city = City.objects.all() category=PropertyCategory.objects.all() status=PropertyStatus.objects.all() return render_to_response('website/services.html',{'property': property