I have a class:
class Transaction(db.Model):
accountDebit = db.ReferenceProperty(reference_class=Account,
collection_name="kontoDuguje")
accountCredit = db.ReferenceProperty(reference_class=Account,
collection_name="kontoPotrazuje")
amount = db.FloatProperty()
Tran_date = db.DateProperty()
comment = db.StringProperty()
here is the method of Account class by which I would like to get all the transactions for the particular account (transactions with accountDebit or accountCredit), but sorted by date:
def GetTransactions(self):
transactions = []
transactions_debit = db.GqlQuery('SELECT * FROM Transaction ' +
'WHERE accountDebit=:1',self)
transactions_credit = db.GqlQuery('SELECT * FROM Transaction ' +
'WHERE accountCredit=:1',self)
for x in transactions_debit:
x.amount = -x.amount
transactions.append(x)
for x in transactions_credit:
x.amount = x.amount
transactions.append(x)
return transactions
The aim is to make union with the sort of this two results, but with limit + offset. Consider the fact that you can not fetch more than 1000 rows in a single query ...
Please help