Sunday, August 25, 2013

Re: Model QuerySet used in base.html template

I'm just preferring if something have to be done before template rendering and store that in context variable.

Difference to your solution is that variables are just only created before starting template rendering.

In your solution you evaluate QuerySet in template rendering time. Sometimes is just bad idea because, you want to separate view stuff from template rendering (especially that django rendering time is sometimes just slower than for example jinja2). 

But it's just my opinion. I'm maybe wrong :) . Feel free to do what you suits best your needs. :)

Cheers,
Kamil 

On Sunday, August 25, 2013 3:58:55 PM UTC+2, Radomir Wojcik wrote:
Hey Kamil,

Isn't that overkill though? templatetag was an easy solution but you still do a query on the locations model on each page load.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment