yaniv14
yaniv14

Reputation: 711

Django template values

I am retrieving model object to my template and I am getting it like this:

value: [{'name_value9': 48}]

When filter the object in the view I am using '.values' like this:

...
name_value.values('name_value' + str(fn))
...

The reason for that is that I have 'name_value1, name_value2, etc... and I need to get to the correct one.

How can I show in the template only the result (value) without the key (name_value9)?

Thanks.

Upvotes: 0

Views: 43

Answers (1)

niekas
niekas

Reputation: 9097

You can print values in your template like this:

{% obj in obj_list %}
    {% for key, value in obj.items %}
        {{ value }}
    {% endfor %}
{% endfor %}

Upvotes: 1

Related Questions