Hi again,

and as I said, Django templating language is not a programming language and
it doesn't support it (it's by design).

If your graphobject is a list of items, use iterating it over as Matthew
Pava suggested in his reply.

Otherwise you need to either create custom tag/filter that returns what you
want, or change dataformat suitable for displaying and processing in
template.

On Thu, Apr 19, 2018 at 7:35 PM, <[email protected]> wrote:

> As I said, the data is already stored in variable: graphobject, I can
> simply achieve my goal by coding like this: {{% graphobject.1%}}, {{%
> graphobject.2 %}} ...... But I want a loop to do that
>
> 在 2018年4月19日星期四 UTC+2下午6:29:18,Jani Tiainen写道:
>>
>> Hi. Django templating language isn't programming language. It can't do
>> that. You need to prepare data suitable for displaying in your view.
>>
>>
>> On Thu, Apr 19, 2018 at 7:01 PM, <[email protected]> wrote:
>>
>>> I am currently working on django.
>>>
>>> I have a list of values which stored in 'graphobject', and 'metarange'
>>> is defined as range(0,59). In that case, how could I use numbers as
>>> argument to display the value stored in graphobject? I tried using
>>> following codes but it doesn't work
>>>
>>>
>>> {% for i in metarange %}{% if graphobject.i != '' %}{{ graphobject.i }}{% 
>>> endif %}{% endfor %}
>>>
>>>
>>> Please tell me how could I do this?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done, and a half done has been sufficient before...
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/75e8baed-3009-4f53-9f72-7260a2467dfc%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/75e8baed-3009-4f53-9f72-7260a2467dfc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odQFoJeynE9bSXRTAw_9CqLC5BJUuyXQ8i3eRBoEPF5rg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to