def _validate_service_before_save(sender, instance, **kwargs): validators.validate_length( instance.name, 1, const.SERVICE_NAME_MAX_LENGTH, error=const.SERVICE_NAME_INVALID_MESSAGE) validators.validate_charset( instance.name, const.SERVICE_NAME_CHARSET, error=const.SERVICE_NAME_INVALID_MESSAGE)
def _validate_snippet_before_save(sender, instance, **kwargs): validators.validate_length( instance.content, 1, const.SNIPPET_MAX_LENGTH, field_name='Snippet')