On Fri, Oct 30, 2009 at 22:10, Javier Guerra wrote:
>
> On Fri, Oct 30, 2009 at 4:05 PM, TiNo wrote:
> > SQL's GROUP BY is made for this isn't it?
>
> no, it's not.
>
> SQL's GROUP BY discards 'individual' rows off the result, showing only
> 'grouping'
On Fri, Oct 30, 2009 at 4:05 PM, TiNo wrote:
> SQL's GROUP BY is made for this isn't it?
no, it's not.
SQL's GROUP BY discards 'individual' rows off the result, showing only
'grouping' rows.
--
Javier
--~--~-~--~~~---~--~~
You received this
On Fri, Oct 30, 2009 at 15:05, Tom Evans wrote:
> SQL cant do this, so do it in python...
SQL's GROUP BY is made for this isn't it?
And it is also possible in django. I guess this is what you need:
SQL cant do this, so do it in python...
items = ItemOwned.objects.filter(user=id)
data = { }
for item in items:
cur_set = data.get(item.setId, {'setId': item.setId, 'items':[]})
cur_set['items'].append({'id': item.id, })
data[item.setId] = cur_set
return
Any ideas anyone?
I'm completely stumped ...
On Oct 30, 12:59 pm, The Danny Bos wrote:
> If helpful, here's the table structure.
>
> class ItemOwned(models.Model):
> user = models.ForeignKey(User)
> item = models.ForeignKey(Item)
>
> class
If helpful, here's the table structure.
class ItemOwned(models.Model):
user = models.ForeignKey(User)
item = models.ForeignKey(Item)
class Item(models.Model):
set = models.ForeignKey(Set)
number = models.IntegerField()
class Set(models.Model):
title =
Hey there, I've got the below query, generating the below JSON. But I
want to group them by "setId", can I do this in my query or in
views.py to create a JSON file like the one at the bottom? Regroup in
a template would be great, but doesn't work in views ...
views.py:
items =
7 matches
Mail list logo