request.session を使用して「最近の」セッション キーを作成し、ユーザーがアクセスした製品ページを追加して、テンプレートでアクセスできるようにしようとしています。これを行うには
class ProductDetail(DetailView):
model = Producto
template_name = 'productos/product_detail.html'
def get_context_data(self, **kwargs):
# Call the base implementation first to get a context
context = super(ProductDetail, self).get_context_data(**kwargs)
# Add in a QuerySet of featured products
context['product_list'] = Producto.objects.filter(featured=True).exclude(pk=self.object.pk)
return context
ご協力いただきありがとうございます!