Hello,
I need to insert some data from database onto every page, so I inserted
them into base.html. Until now, I was using generic views but it doesn't
seems to be ideal for this case. Is there a way how to achieve this
behaviour with generic views or I have to insert needed model into every
custom view?
I tried it this way, but update() returns None, so it doesn't work, but it
demonstrates what I am looking for:
currency_by_date = {
"queryset": Currency.objects.all().order_by('-date', 'currency')[:2],
"template_name": "home.html",
"template_object_name": "currency",
}
urlpatterns = patterns('',
(r'^$', 'django.views.generic.list_detail.object_list',
currency_by_date),
(r'^profil_spolocnosti/$',
'django.views.generic.list_detail.object_list',
currency_by_date.update({"template_name":
"profil_spolocnosti.html"})),
...
If I have to use custom views what is the best way to include above
queryset result into templates without repeating it over every view?
Thank you for your help,
Martin
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.