Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6591197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:23:39+00:00 2026-05-25T17:23:39+00:00

See my previous question . I updated the code as per Kevin P’s answer

  • 0

See my previous question. I updated the code as per Kevin P’s answer but now I am not able to sort with newest tag on top. My comments are below at query.order("date"). Do you know why date with a minus sign works but it does not work without minus sign?

my model is:

class Owner(db.Model):
    owner = db.UserProperty()
    owner_tag = db.StringProperty()
    tag_value = db.IntegerProperty()
    url = db.StringProperty()    

Handler that draws tag table:

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

#-----------tags table-----------------#
            query = Owner.all()
            query.filter("owner =", user)
            if not order_by:
                query.order("owner_tag")
#-----------when both "date" has a minus sign the table is sorted correctly
#-----------when I remove the minus signs I get `PropertyError: Invalid property name 'date'`
            elif order_by == "-date":
                query.order("-date")
            w = query.fetch(500)

            user_tag_list = []
            for item in w:
                user_tag_list.append(item.owner_tag)

#            unique_tags = sorted(f1.f2(user_tag_list))                 
            unique_tags = f1.f2(user_tag_list) 

#-----------holding table start--------#
            self.response.out.write("""
            <table border="0" cellpadding="0" cellspacing="20" >
            <tr>
            <td>""")

#-----------tags table start--------#                                   
            self.response.out.write("""<table border="1">
            <tr>
            <th colspan="3">tags<br />
            <a href="/useradminpage?order=date"><span id=small>most recent</span></a></th>
            </tr>
            """)      

            for tag in unique_tags:

                self.response.out.write("""
                    <tr>
                    <td><a href="/tag?tag=%s">%s</a></td>
                    </tr>
                    """ %
                    (tag, tag)
                    )

            self.response.out.write("""</table>""")  

...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:23:40+00:00Added an answer on May 25, 2026 at 5:23 pm

    Right now you are relying on the fact that keys typically generate in sequence, which isn’t always the case. Add a date property to your model:

    date= db.DateTimeProperty(auto_now_add=True)
    

    Also fix your GET parameter so that it’s consistent. Here:

    <a href="/useradminpage?order=xyz"><span id=small>most recent</span></a>
    

    and here:

    elif order_by == "xyz":
        query.order("date")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a related to a previous question I have asked here, see the
I am aware of this question , but it does not appear to work
This question is an updated version of a previous question I have asked on
Carrying on from my previous question, which has now been solved: Issue with Pointers
This is related to a previous question . What I'm trying to understand now
I'm working on building Cppcheck on AIX with the xlC compiler (see previous question
Surprisingly I was only able to find one previous question on SO about this
I recently posted my question see previous question and received a great working solution
I just generated a class using the xsd.exe (See previous question ) and then
[This is an updated version of a question posted earlier, the previous title was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.