Lukasz Szybalski wrote: > I have a tg function that is called search. It has a widget with few > text fields. I submit results to > > def searchresults(sefl, **kwargs) > #do some selects > return dict(myresults=myresults) > > Is there a way for me to resubmit to this function after it returned? > > /searchresults has my results. I want to sort them by few fields > > Is this possible? > > /searchresults/LastName > or > /searchresults/City > > If not what other options I have?
You can handle that this way, I assume you will order by fields of model
"Contact":
def searchresults(self, *kw, **kwargs):
orderBy = None
if len(kw) > 0 and hasattr(Contact.q, kw[0]):
orderBy = getattr(Contact.q, kw[0])
# do some selects, now with orderBy=orderBy
return dict(myresults=myresults)
-- W-Mark Kubacki
smime.p7s
Description: S/MIME Cryptographic Signature

