I have three Decimal fields that all have the same validator:
`
class MyModel(models.Model):
one = models.DecimalField(validators=[great_than_zero])
two = models.DecimalField(validators=[great_than_zero]
three = models.DecimalField(validators=[great_than_zero]
`
Is there a pythonic way to enforce this validator for the entire model, so that no Decimal Field can have a negative number. If I know that all of my Decimal fields will be positive, it would be nice to not right the same piece of code for each one.
from Recent Questions - Stack Overflow https://ift.tt/3jmX7cv
https://ift.tt/eA8V8J
No comments:
Post a Comment