Hi, i use this code in my application, it works very good when i insert a new record, but i have a little problem when i want to update a registry. For example:
I have un my table inventory: product, country, quantity If i insert pencil, canada, 40 it inserts fine then if i want to insert again pencil, canada, 50 it doesnt insert beacuse i already have pencils in canada. This is working fine. My problem is here, in the update. For example I want to update my number of pencils in Canada, beacause i buy another 50 pencils. I put update pencil, canada, 90 But it says it already have pencils in canada, its like i am inserting a new registry and not doing an update. How can i solve this? This is my validator, is in the model: class IS_NOT_IN_DB_DDOWN_UIM(IS_IN_DB): def __init__(self,*a,**b): IS_IN_DB.__init__(self,*a,**b) def __call__(self,value): e=IS_IN_DB.__call__(self,value) if e[1]:return e e=IS_NOT_IN_DB(db (db.Inventory.idProduct==request.vars.idProduct),'Inventory.idCountry',error_message=self.error_message) (value) return e db.Inventory.idCountry.requires=IS_NOT_IN_DB_DDOWN_UIM (db,'Country.id','%(nCountry)s',error_message="The product is already in this country.") -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.