slm.validators¶
- class slm.validators.Flag¶
Bases:
tupleFlag(message, manual, severity)
- static __new__(_cls, message, manual, severity)¶
Create new instance of Flag(message, manual, severity)
- manual¶
Alias for field number 1
- message¶
Alias for field number 0
- severity¶
Alias for field number 2
- slm.validators.get_validators(model, field)[source]¶
Get the validator list for a given model and field from validation settings.
- Parameters:
model – The Django model name <app_name>.<ModelClass>
field – The field name
- Returns:
- slm.validators.bypass_block()[source]¶
Return if we should bypass any validation save blocking. This setting is controlled by the SLM_VALIDATION_BYPASS_BLOCK setting in settings or can be preempted by toggling the BYPASS_BLOCKS flag above.
This is important when working with legacy data. All validators should respect this flag.
- Returns:
True if we should bypass any save blocks
- class slm.validators.TimeRangeBookendValidator[source]¶
Bases:
SLMValidatorEnsures that sections that should not have overlapping time ranges are properly bookended - i.e. that the time range fields are closed before the next section starts.
- class slm.validators.PositionsMatchValidator[source]¶
Bases:
SLMValidatorAttach this validator to SiteLocation llh and/or xyz fields to validate that these positions are within the given tolerance of each other.
- __init__(*args, severity=FlagSeverity.BLOCK_SAVE, tolerance=1.0, **kwargs)[source]¶
- Parameters:
tolerance (float)
- tolerance = 1.0¶
3D tolerance in meters between the positions before flagging.