I don't understand where the [] symbol in your example come from.
Have you tried to get a detailed view of tags_hx, with {{ tags_hx|pprint }} ?
2017-04-15 22:40 GMT+02:00 Moreplavec <stanislav.vasko@gmail.com>:
> Greetings,
>
> i'm trying to parse HTML website and present same basic info about it. I'm
> using BeuatifulSoup4 and Python3. Code is simple, but i have problem to
> force Django template show variables in my list. For example this simple
> code in template:
>
>> {{ tags_hx }}
>> <h1>Tags H1 - H7</h1>
>> <table class="table-striped table table-hover">
>> {% for tag in tags_hx %}
>> <tr>
>> <td>{% autoescape off %}{{ tag|safe }}{% endautoescape
>> %}</td>
>> </tr>
>> {% endfor %}
>> </table>
>
>
> while {{ tags_hx }} prints lists exactly i have:
>
>> [<h1 style="text-align: center"><span style="color: rgb(178, 34,
>> 34);">Beginners English Tests 1</span></h1>, <h3>Grammar</h3>, <h3>Beginners
>> ESL</h3>, <h3>For Kids</h3>, <h3>Reading Skills</h3>, <h3>Major Exams</h3>,
>> <h3>Writing & Vocab</h3>]
>
>
> but i can't get or force Django template to show each tag in table. All i
> get is:
>
>> Tags H1 - H7
>> [Beginners English Tests 1]
>> []
>> []
>> []
>> []
>> []
>> []
>
>
> I know, when i insert html code in template it will be used by browser, but
> just makes me mad i can't get to work it :) Autoescape or |safe doesn't
> help. Please, can you help me how to force simple output tags in cycle
> regardless of the consequences?
>
> Thanks!
>
> --
> 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 django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> 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/23ba36b8-b550-4eb8-acda-382f0cd7e481%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Cordialement, Ludovic Coues
+33 6 14 87 43 42
--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/CAEuG%2BTZukFjaqUV9dcZNFaEwZJ7qXzVh_i6bfeNC8C3t-1KVzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment