Hi,
I am struggling to get a piece of code working.
I've looked at it too much and now can't see what im doing wrong.
Anyone have any ideas? The error is as follows:
Type Error
string indices must be integers - (if ids['m'['manufacturer__id']] is
not m['manufacturer__id']: )
Code:
tmp_manufacturers = Product.objects.filter(category=category).values(
'manufacturer__title', 'manufacturer__slug',
'manufacturer__id'
).distinct()
manufacturers = {}
for m in tmp_manufacturers:
ids = {}
if ids['m'['manufacturer__title']] is not
m['manufacturer__title']:
ids.append(m['manufacturer__title'])
manufacturers.append({
'title': m['manufacturer__title'],
'slug': m['manufacturer__slug'],
'id': m['manufacturer__id'],
'total_products': Product.objects.filter(
category=category,
manufacturer__slug=m['manufacturer__slug']
).count()
})
Also, does anyone have any decent documentation on arrays?
--
You received this message because you are subscribed to the Google Groups
"Django 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/django-users?hl=en.