Skip to content Skip to sidebar Skip to footer

Changing Display Order Of Tags In A Table (google App Engine-python)

I have a table in UserAdminPage where tags are listed by alpha order (code below). I want to add a link that will change the order to by date. I know I will change the query.order(

Solution 1:

There are a number of ways to optimize your approach to this, but to answer your specific question - rather than duplicate your handler you could add a GET parameter to the link and then check for that while constructing your query:

class UserAdminPage(webapp.RequestHandler):
    def get(self):
        order_by = self.request.get('order')

        query = Owner.all() 
        query.filter("owner =", user)
        if not order_by:
            query.order("owner_tag")
        elif order_by == 'date':
            query.order("-date")

        ...
        <a href="your_page_url?order=date">order tags by most recent</a>

Post a Comment for "Changing Display Order Of Tags In A Table (google App Engine-python)"