Answer the question
In order to leave comments, you need to log in
Why is there a different number of posts on the page all the time?
There is such a cycle. For some reason, Chrome always displays a different number of records. In IE and Opera everything is fine. Clearing the cache doesn't help.
{% 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 %}
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
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question