Z
Z
zelsky2015-10-09 12:23:29
Django
zelsky, 2015-10-09 12:23:29

Parse Django queryset?

I receive an answer like this.
Here, it turned out to display the number in badges, but the names before the badge do not get where to dig?
+ the last badge is empty.

[{'count_r': 1}, {'count_r': 0}, {'count_r': 0}, {'count_r': 0}, {'count_r': 0}, {'count_r': 0}, {'count_r': 0}, {'count_r': 0}, [<Rozdil: zxczxc>, <Rozdil: zxczxczxc>, <Rozdil: zxczxc>, <Rozdil: zxczxc>, <Rozdil: zxc zxc. zxczxc>, <Rozdil: zxczxc>, <Rozdil: zxc-zxc>, <Rozdil: zxc- zxczxc>]] - See more at: http://127.0.0.1:8000/part/1/#sthash.QXTFrROp.dpuf

count_rozdils= []
get_all_rzdls = Rozdil.objects.all().filter(part_of_id=id_part)
    for rozd in get_all_rzdls:
        count_rozdils.append({'count_r':Stats.objects.filter(from_part=rozd).count()})
    count_rozdils.append(get_all_rzdls)
    context = {'foo': foo,'count_rozdils':count_rozdils}
    return render(request,'part.html',context)

<ul class="list-group list-group-inverse">

{% for a in count_rozdils  %}

  <li class="list-group-item">

    <span class="badge">{{ a.count_r}}</span>
   
    <a href="{{ a..get_absolute_url | safe}}">{{ a..title }}</a>
  </li>

{% endfor %}
{{count_rozdils}}

</ul>
{% endblock %}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2015-10-09
@sim3x

Shield..

U
un1t, 2015-10-10
@un1t

<a href="{{ a..get_absolute_url | safe}}">{{ a..title }}</a>

Why are there two dots?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question