Вроде сделал но через попу явно def root2 request slug brand typeof sl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
Вроде сделал, но через попу явно..
def root2(request, slug):
brand, typeof = slug.split("-")
try:
category1 = Category.objects.get(slug=brand)
category2 = Category.objects.get(slug=typeof)
except IndexError:
return bad_or_missing(request, _('The category you have requested does not exist.'))
products1 = Product.objects.filter(category=category1)
products2 = Product.objects.filter(category=category2)
prod = []
for i in products1:
for z in products2:
if i.id == z.id:
prod.append(i)
return render_to_response('base_categories.html', {'products': prod}, RequestContext(request))