title: GAE Datastore Put()
body: <pre><code>def post(self):
      update = self.request.get('update')
  
      if users.get_current_user():
          if update:
              personal = db.GqlQuery("SELECT * FROM Personal WHERE __key__ = :1", db.Key(update))
  
              personal.name = self.request.get('name')
              personal.gender = self.request.get('gender')
              personal.mobile_num = self.request.get('mobile_num')
              personal.birthdate = int(self.request.get('birthdate'))
              personal.birthplace = self.request.get('birthplace')
              personal.address = self.request.get('address')
              personal.geo_pos = self.request.get('geo_pos')
              personal.info = self.request.get('info')
              photo = images.resize(self.request.get('img'), 0, 80)
              personal.photo = db.Blob(photo)
              personal.put()
              self.redirect('/admin/personal')
          else:
              personal= Personal()
  
              personal.name = self.request.get('name')
              personal.gender = self.request.get('gender')
              personal.mobile_num = self.request.get('mobile_num')
              personal.birthdate = int(self.request.get('birthdate'))
              personal.birthplace = self.request.get('birthplace')
              personal.address = self.request.get('address')
              personal.geo_pos = self.request.get('geo_pos')
              personal.info = self.request.get('info')
              photo = images.resize(self.request.get('img'), 0, 80)
              personal.photo = db.Blob(photo)
              personal.put()
              self.redirect('/admin/personal')
  
      else:
          self.response.out.write('I\'m sorry, you don\'t have permission to add this LP Personal Data.')
  </code></pre>
  
  <p>Should this will update the existing record if the 'update' is querystring containing key datastore key. I try this but keep adding new record/entity. Please give me some sugesstion to correctly updating the record/entity.</p>
  
  <p>Correction? :</p>
  
  <pre><code>def post(self):
      update = self.request.get('update')
  
      if users.get_current_user():
          if update:
              personal = Personal.get(db.Key(update))
  
              personal.name = self.request.get('name')
              personal.gender = self.request.get('gender')
              personal.mobile_num = self.request.get('mobile_num')
              personal.birthdate = int(self.request.get('birthdate'))
              personal.birthplace = self.request.get('birthplace')
              personal.address = self.request.get('address')
              personal.geo_pos = self.request.get('geo_pos')
              personal.info = self.request.get('info')
              photo = images.resize(self.request.get('img'), 0, 80)
              personal.photo = db.Blob(photo)
              personal.put()
              self.redirect('/admin/personal')
          else:
              personal= Personal()
  
              personal.name = self.request.get('name')
              personal.gender = self.request.get('gender')
              personal.mobile_num = self.request.get('mobile_num')
              personal.birthdate = int(self.request.get('birthdate'))
              personal.birthplace = self.request.get('birthplace')
              personal.address = self.request.get('address')
              personal.geo_pos = self.request.get('geo_pos')
              personal.info = self.request.get('info')
              photo = images.resize(self.request.get('img'), 0, 80)
              personal.photo = db.Blob(photo)
              personal.put()
              self.redirect('/admin/personal')
  
      else:
          self.response.out.write('I\'m sorry, you don\'t have permission to add this LP Personal Data.')
  </code></pre>