On Jan 14, 2008 8:17 PM, W-Mark Kubacki <[EMAIL PROTECTED]> wrote: > 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) >
Assuming this function return. Now I have ordered them by Lastname let say. In my template there will be a link /searchresults/FirstName How will this link know the search categories? (aka **kwargs). All that information is in kwargs when first passed in isn't it? I don't see a way my link /searchresults/FirstName can sort the results I got. Lucas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

