Model has:
value = models.IntegerField(validators=[MinValueValidator(0)], default=0)
this works fine with django admin section, but if you try to reduce value via api, the value can be reduced to negative, so how to i reflect the constrain of min value to mysql database as well? As i dont have database access, so has to do via model only or via django
api works as:
not actual code, looks like
StoreCredits.objects.filter(store_id=store_id).update(value= reduce value here)
I dont wanna use PositiveIntegerField as its min limit will be 0, suppose i want min limit to be -100 and if someone tries to update record (reduce value) and the value falls below that it should throw djang.db.DataError or some that i can then handle