How to validate before save in my custom app

How to Validate before save in my custom app??

On which doc do you want to apply validations on?
Your own custom doc or Some standard doc?

my own custom doc let say member. in that doc i have some calculations ( that i have done in .py file) if that function should validate before save else it shot not save the doc.

add this to your doc.

def validate(self):
     # Raise error anyways to demonstrate validate func
     frappe.throw(_("Invalid condition"))

thanks. working ;);););););););):wink: