On Wed, Aug 10, 2011 at 10:37 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote:
> On 10 août, 21:52, Kayode Odeyemi <drey...@gmail.com> wrote: > > You don't pass anything from "one view to another". You eventually > pass data from a request to another, using either request params > (querystring, post...), cookies, or sessions (and of course the parts > of your urls that become view args). > > > For instance, I have a request model dynamic data > > Sorry, but I don't know what a "request model dynamic data" is > supposed to be. Care to explain more clearly ? > > I meant a paginated model rendered in a view. Something like: def func(request, **kwargs): obj = Model.objects.all() SHOW_CONTENT_LIMIT = 2 paginate_list = Paginator(dataqs, SHOW_CONTENT_LIMIT) page_no = int(request.GET.get(u'page', 1)) contents = paginate_list.page(page_no) ... ... #make a dict of the page number and it's content x = {contents.number:contents.object_list} #store it in a session request.session['contents'] = x return render_to_response('template.html', {'contents', contents}, context_instance=RequestContext(request)); def func2(request, **kwargs): page = int(request.GET.get('page')) # retrieve a slice of the session data by page request.session['contents'][page] #write to csv ... return HTTPResponse So I'm thinking, wouldn't it be pretty to create a template tag that can make the current session object available to the view - a concept similar to JSTL tag. Is this something template tags can be useful - making standard Python objects available to templates right? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.