On Sun, May 11, 2014 at 9:35 AM, Yannick <[email protected]> wrote:
> Hello mate,
>
> I have an issue as follow. I'm trying to display a Json in my view doing
> this:
> *- In the views.py*
> @view_config(route_name='display',
> renderer='templates/display_user.jinja2')
> def display_user(request):
> * # Get listUser from the database*
> * # Below I print the list and everything look good*
> print dumps(listUser)
> return {'listUser': dumps(listUser)}
>
> *- In the view page - display_user.jinja2, I do this*
>
> {% for user in listUser %}
> {{ user}}
> {% endfor %}
>
>
> ---------------------------------------------------
> When I do that nothing is display. The JSON I sent is empty. I'm wondering
> why ??? In the back-end I can print the list of element.
>
>
What you wrote is probably not what you want. If "for user in listUser"
worked at all, it would be iterating over the characters of the string. The
result of json.dumps is a string.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.