Hi, I have an entity like this:
class Item(Entity):
title = Field(Uncode(32))
agree = Field(Integer)
vote = ManyToOne('Vote')
class Vote(Entity):
title = Field(Uncode(32))
items = OneToMany('Item')
Now I'd like to get sum of all agree of items. I remember that I have
seen some method like this:
class Vote(Entity):
title = Field(Uncode(32))
items = OneToMany('Item')
@property
def sumOfAgree(self):
# do something to sum agree
return sum
It is so difficult to search information about Elixir, so I find no
proper examples that show how to achieve that.
And here comes another problem. What If I'd like to sort by
sumOfAgree?
For example:
hotVoteList = Vote.query.order_by(desc(Vote.sumOfAgree))
Is that possible to do what I want with Elixir? how? I will be
appreciate.
Thanks.
Victor Lin.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---