title: Python - Google App Engine - Get model ID in Dict
body: <p>In my Google App Engine - Python app, I've got a to_dict() to allow JSON serialization of my models.</p>
  
  <pre><code>class BaseModel(db.Model):
    createdOn = db.DateTimeProperty(auto_now_add=True)
    createdBy = db.UserProperty(auto_current_user_add=True)
    modifiedOn = db.DateTimeProperty(auto_now_add=True)
    modifiedBy = db.UserProperty(auto_current_user=True)
  
    def to_dict(self):
      return dict([(p, unicode(getattr(self, p))) for p in self.properties()])
  </code></pre>
  
  <p>How do I ensure that modelInstance.key().id() is part of the dict, hence part of the JSON object?</p>