object_validator

class camelot.admin.validator.object_validator.ObjectValidator(admin, model=None)[source]

A validator class for normal python objects. By default this validator declares all objects valid. Subclass this class and overwrite it’s validate_object method to change it’s behaviour.

get_first_invalid_row()[source]
Returns:the row number of the first invalid row (where the first row has number 0)

Get the validator for another Class :param cls: the Class for which to get the validator :return: an ObjectValidator instance

isValid(row)[source]

Verify if a row in a model is ‘valid’ meaning it could be flushed to the database

number_of_invalid_rows()[source]
Returns:the number of invalid rows in a model, as they have been verified
validate_all_rows()[source]

Force validation of all rows in the model

validate_object(obj)[source]
Returns:list of messages explaining invalid data, an empty list if the object is valid