validators.rst 789 B

12345678910111213141516171819
  1. =================
  2. Misago Validators
  3. =================
  4. Misago apps implement plenty of validators, someof which are considered public API. Those validators are documented here.
  5. validate_sluggable
  6. ==================
  7. :py:class:`misago.core.validators.validate_sluggable`
  8. Callable class that validates if string can be converted to non-empty slug thats no longer than 255 characters.
  9. To you use it, first instantiate it. If you want to define custom error messages, you can pass them using ``error_short`` and ``error_long`` arguments on initializer. After that you can simply call the class like other validator functions to see if it raises ``ValidationError``::
  10. from misago.core.validators import validate_sluggable
  11. validator = validate_sluggable()
  12. validator(some_value)