django_auxilium.forms.range module

class django_auxilium.forms.range.RangeSelectorField(*args, **kwargs)[source]

Bases: django.forms.fields.CharField

Range field which supports Excel-type rangeconfig selectors.

The rangeconfig selection is made using the following format:

<Column><Row>:<Column><Row>

Examples

A:A
A1:A50
1:50
Parameters:
  • max_rows (int, optional) – The maximum number of rows the range can have
  • max_columns (int, optional) – The maximum number of columns the range can have
  • max_either (int, optional) – The maximum number of rows and columns the range can have. For example if the value is 1 then either a single column or a single row can be selected.
  • required_rows (bool, optional) – Whether rows must be supplied in the rangeconfig
  • required_columns (bool, optional) – Whether columns must be supplied in the rangeconfig
default_error_messages = {u'invalid': u'Invalid range value.', u'max_columns': u'Too many columns selected. Maximum is {0}.', u'max_either': u'Too many rows or columns selected. Maximum is {0}.', u'max_rows': u'Too many rows selected. Maximum is {0}.', u'max_total': u'Too many total cells selected. Maximum is {0}.', u'required_columns': u'Column selection is required.', u'required_rows': u'Row selection is required.', u'values': u'Top-left coordinate must be first.'}
to_python(value)[source]

Convert range string value to Range rangeconfig value.

Returns:
Return type:Range
validate(value)[source]

Validate the rangeconfig value.

Following is validated:

  • rows or columns are supplied depending on required_row and required_columns parameters
  • rangeconfig is given as top-left to bottom-right
  • columns range is within max_columns
  • rows range is within max_rows
  • both columns and rows range is within max_either