I have added an attributte called material in the attribute options.
In order to display in a page the products of a particular category
filtered according to their type of material, i have defined a
material_view function in my views.py and a custom template called
material.html.
My function is like the one below:

def material_view(request, material_slug, slug, parent_slugs='',
template='product/material.html'):

    try:
        category =  Category.objects.get_by_site(slug=slug)
        product_list = list(category.active_products())
        sale = find_best_auto_discount(product_list)
        materialized = []
        for product in product_list:
            if product.translated_attributes()[0].value ==
material_slug:
                materialized.append(product)
           else:
                continue

    except Category.DoesNotExist:
        return bad_or_missing(request, _('The category you have
requested does not exist.'))

    child_categories = category.get_all_children()

     ctx = {
               'category': category,
               'child_categories': child_categories,
               'sale' : sale,
               'materialized' : materialized,
           }

    return render_to_response(template, RequestContext(request,ctx))

My url definition if fine because if i replace this function with a
much simpler like this:

 def material_view(request, material_slug, slug, parent_slugs='',
template='product/material.html'):
     ctx = RequestContext(request, {})
     return render_to_response(template, context_instance=ctx)

i am directed to the correct template(material.html)
Any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
"Satchmo users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/satchmo-users?hl=en.

Reply via email to