Django LFS - custom views
- by owca
For all those ligthning fast shop users. I'm trying to implement my own first page view that will list all products from shop ( under '/' address). So I have a template :
{% extends "lfs/shop/shop_base.html" %}
{% block content %}
<div id="najnowsze_produkty">
<ul>
{% for obj in objects %}
<li>
{{ obj.name }}
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
and then I've edited main shop view :
from lfs.catalog.models import Category
from lfs.catalog.models import Product
def shop_view(request, template_name="lfs/shop/shop.html"):
products = Product.objects.all()
shop = lfs_get_object_or_404(Shop, pk=1)
return render_to_response(template_name, RequestContext(request, {
"shop" : shop, "products" : products
}))
but it just shows nothing. When I do Product.objects.all() query in shell I get results. Any ideas what could cause the problem ? Maybe I should filter products with 'active' status only ? But I'm not sure if it can influence all objects in any way.