I have to run some benchmarks and see. I am using SQLite and I have heard
some people say that it cannot handle concurrent transactions. From what I
read it can handle some 50,000 transactions/ sec depending on your disk IO.
For a small deli website I take it should be fine, even if the user pl
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
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
I simply added an assignment tag instead as follows:
@register.assignment_tag
def get_locations():
from store.models import Location
locations = list(Location.objects.all())
return locations
And use it like so in template
{% get_locations as all_locations %}
then can
Hi Radomir,
If you have something like that you should use in my opinion template
context processor. It's very easy to write one, because it's simple python
function.
Here you have some context_processor from django
core:
https://github.com/django/django/blob/master/django/core/context_proces
I am actually thinking using some sort of templatetag now instead of
passing the query each time since its used in base.html. It can return the
exact html string that can be displayed in base.html. Right now I have the
" locations = Location.objects.all() " passed to the template in every
sing
I wanted to add location address in the menu. I have a model called
locations so this is easy enough to do. But now I have to add the queryset
to every view, because every view has a template that extends base.html.
So do I have to add this queryset as such to every view now?
locations = Locat
7 matches
Mail list logo