a = [1, 2, 3, 4, 5, 6, 7]
a.append(a.pop(0))
a
>>> [2, 3, 4, 5, 6, 7, 1]
class MyView(ListView):
model = MyModel
def get_queryset(self):
products = super().get_queryset().filter(active=True, category=self.category)
products = products.select_related(
'category', 'provider', 'sale', 'margin', 'special_proposition').prefetch_related(
'parameter_values__product_parameter', 'parameter_values__value',
'price_correctors', 'images')
products = self.filter_prices(products)
products = self.filter_params(products)
products = self.order_products(products)
return products
tags = Tag.objects.filter().get(id=id) posts = tags.post_set.all()
posts = Main.objects.filter(tag_in_main_id=id)
чем это проще? и зачем лишнюю переменную создавать? у меня красивее))