Есть такой цикл. В Chrome почему-то всегда выводится разное количество записей. В IE и Opera всё нормально. Сброс кеша не помогает.
{% for draft in drafts %}
<div class="item">
<div class="price-item">
<a href="{% url 'draft_detail' draft.slug %}" class="upper">
<div class="slideshow">
{% thumbnail draft.img "800" crop="center" as image %}
<img src="{{ image.url }}" alt="" style="z-index: 1; display: block;" />
{% endthumbnail %}
</div>
<div class="desc_box centered">
<div class="label col-md-6 offset-md-3">
<p class="name">Расчет № {{ draft.number }}</p>
<p class="desc">{{ draft.title }}<br / >
{{ draft.get_oven_display }}<br / >
{{ draft.furnish }}<br />
<span class="yellow">{{ draft.get_full_price|intcomma }} СЂ.</span>
</p>
<button class="btn btn-transparent btn-full upper white">Подробнее</button>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
View:
from django.db.models import Q
from django.views.generic import ListView, DetailView
from flatcontent.views import FlatContentMixin
from .models import Draft
class DraftListView(FlatContentMixin, ListView):
queryset = Draft.objects.filter(is_active=True).order_by('id')
context_object_name = 'drafts'
paginate_by = 120
template_name = 'prices/prices.html'
class DraftListAjaxView(FlatContentMixin, ListView):
paginate_by = 120
queryset = Draft.objects.filter(is_active=True).order_by('id')
context_object_name = 'drafts'
template_name = 'prices/prices_ajax.html'
class DraftDetailView(DetailView):
model = Draft
template_name = 'prices/price_detail.html'
def get_context_data(self, **kwargs):
context = super(DraftDetailView, self).get_context_data(**kwargs)
draft = Draft.objects.get(slug=self.kwargs['slug'])
properties = draft.draftproperty_set.all()
context['badges'] = properties.filter(~Q(img__exact=''))
return context