Validators
See original GitHub issueIs your feature request related to a problem? Please describe. In our project, we need to validate settings values when modified through the Django admin UI. E.g. for an integer field, we would like to validate the value to be positive.
Right now the package doesn’t provide positive integer field type or validators.
Describe the solution you’d like
# A solution with a validator parameter that accepts a function
months = Setting(
name="MONTHS",
value_type=Setting.TYPE_INT,
value=48,
description="Number of months.",
validator=lambda x: x>0,
)
months.save()
Describe alternatives you’ve considered
# A solution based on native datatypes
# this can't be supported by all dbs:
# i.e. PostgreSQL does not have an unsigned integer
months = Setting(
name="MONTHS",
value_type=Setting.TYPE_POSITIVE_INT,
value=48,
description="Number of months.",
)
months.save()
Issue Analytics
- State:
- Created a year ago
- Comments:14 (13 by maintainers)
Top Results From Across the Web
Validators - Angular
A validator is a function that processes a FormControl or collection of controls and returns an error map or null. A null map...
Read more >The W3C Markup Validation Service
This validator checks the markup validity of Web documents in HTML, XHTML, SMIL, MathML, etc. If you wish to validate specific content such...
Read more >validators — validators 0.11.2 documentation
Each validator in validators is a simple function that takes the value to validate and possibly some additional key-value arguments.
Read more >Validator - Wikipedia
A validator is a computer program used to check the validity or syntactical correctness of a fragment of code or document. The term...
Read more >Custom Form Validators • Angular - codecraft.tv
A validator in Angular is a function which returns null if a control is valid or an error object if it's invalid. For...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @fabiocaccamo Thank you so much! Also for latest improvements and the addition to the README.
No, I don’t think the validator path would be useful in the changelist.
Thank you again. We will update to 0.6 soon.
@domeniconappo you can upgrade to
0.6.1