Closed robi-tacutu closed 8 years ago
You need to construct the dict in your view first and then pass it to the template as a context variable.
In view: context = { 'extra_kwargs' : {'a':5, 'b':6} } return render(request, 'my_template.html', context)
in template: url_extra_kwargs=extra_kwargs
try this
in view def get_context_data(self, kwargs): context = super(ChannelsVideoView, self).get_context_data(kwargs) extra_kwargs = {'page': self.kwargs['page'], 'slug': self.kwargs['slug']} context['extra_kwargs'] = extra_kwargs return context
in temple {% bootstrap_paginate page_obj range=7 centered="true" show_first_last="true" url_view_name="channels_video_view" url_extra_kwargs=extra_kwargs %}
Directly passing a dict: url_extra_kwargs={'a':5, 'b':6} to the template tag results in TemplateSyntaxError with: Could not parse the remainder: '{'a':5,' from '{'a':5,'
Passing the dictionary as a string doesn't convert it later into a dict and results in TypeError - 'SafeText' object does not support item assignment, when setting the url_param_name in get_page_url.