Am working on GAE,GAE datastore and python.
This is my dbmodel.py,
class Customer(db.Model):
name = db.StringProperty(required=True)
phone = db.PhoneNumberProperty(required=True)
email = db.EmailProperty(required=True)
this is my main.py,
class AddCustomerHandler(BaseHandler):
def get(self):
template = jinja_environment.get_template('template/addcustomer.html')
self.response.out.write(template.render(template_values))
def post(self):
input_fullname=self.request.get('fullname')
input_phone=self.request.get('phone')
input_email=self.request.get('email')
newcustomer=Customer(name=input_fullname,phone=input_phone,email=input_email)
self.redirect('/addcustomer')
Data store is working fine. I want to check the my newcustomer
data duplicate or not based on fullname. if its already entered the data didn't allow to save and need to display the error message.
How can i do that?
There's good Unique model available in webapp2:
This is the only way to transactionally check the uniqueness.
https://webapp-improved.appspot.com/_modules/webapp2_extras/appengine/auth/models.html#Unique