title: TypeError: bad operand type for unary -: 'type'
body: <p>Good day!</p>
  
  <p>I am using google app engine with python code and a problem occurred</p>
  
  <p>the helloworld.py file:</p>
  
  <pre><code>import os
  import urllib
  
  import jinja2
  import webapp2
  import datetime
  
  from google.appengine.api import users
  from google.appengine.ext import ndb
  
  JINJA_ENVIRONMENT = jinja2.Environment(
  loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
  extensions=['jinja2.ext.autoescape'])
  
  class MainPage(webapp2.RequestHandler):
  
    def get(self):
  
      user = users.get_current_user()
  
      if user:
        template_values = {
      'nickname' : user.nickname(),
        }
  
        template = JINJA_ENVIRONMENT.get_template('index.html')
        self.response.write(template.render(template_values))
  
      else:
        self.redirect(users.create_login_url(self.request.uri))
  
  class Tutorial6(webapp2.RequestHandler):
  
    def get(self):
      numbers = []
      for i in range(10):
      numbers.append(i)
  
      template_values = {
        'numbers': numbers
      }
  
      template = JINJA_ENVIRONMENT.get_template('/templates/tutorial6.html')
      self.response.write(template.render(template_values))
  
  class Tutorial7(webapp2.RequestHandler):
  
    def get(self):
  
    if users.get_current_user():
      url = users.create_logout_url(self.request.uri)
      url_linktext = 'Logout'
  
    else:
      url = users.create_login_url(self.request.uri)
      url_linktext = 'Login'
  
    cats_query = Cat.query().order(-Cat.date_of_birth)
  
    cats = cats_query.fetch(10)
    template_values = {
      'cats': cats,
      'url': url,
      'url_linktext': url_linktext,
    }
  
    template = JINJA_ENVIRONMENT.get_template('/templates/tutorial7.html')
    self.response.write(template.render(template_values))
  
    def post(self):
      user = users.get_current_user()
  
      if user:
        cat = Cat()
        cat.owner = user
        cat.name = self.request.get('name')
        cat.description = self.request.get('description')
        day = self.request.get('day')
        month = self.request.get('month')
        year = self.request.get('year')
        cat.date_of_birth = datetime.date(year=int(year), month=int(month), day=int(day))
  
        cat.put()
        self.redirect('/tutorial7')
  
      else:
        self.redirect(users.create_login_url(self.request.uri))
  
  class Cat(ndb.Model):
    owner = ndb.UserProperty()
    name = ndb.StringProperty()
    date_of_birth = ndb.DateProperty
    description = ndb.StringProperty(indexed=False)
  
  application = webapp2.WSGIApplication([
      ('/', MainPage),
      ('/tutorial6', Tutorial6),
      ('/tutorial7', Tutorial7),
     ], debug=True)
  </code></pre>
  
  <p>and when I tested it on local server, it gave this error message:</p>
  
  <pre><code>File "/home/RMITVNNET/s3408675/Desktop/.HDrive/s3372661-s3408675/helloworld.py", line 58, in get
  cats_query = Cat.query().order(-Cat.date_of_birth)
  TypeError: bad operand type for unary -: 'type'
  </code></pre>
  
  <p>I don't know what's wrong although the code looks fine. Any ideas how to fix it? </p>