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'required_rows': <django.utils.functional.__proxy__ object at 0x7f7445fa4b50>, u'max_columns': <django.utils.functional.__proxy__ object at 0x7f7445fa49d0>, u'max_rows': <django.utils.functional.__proxy__ object at 0x7f7445fa4990>, u'required_columns': <django.utils.functional.__proxy__ object at 0x7f7445fa4bd0>, u'values': <django.utils.functional.__proxy__ object at 0x7f7445fa4950>, u'max_total': <django.utils.functional.__proxy__ object at 0x7f7445fa4ad0>, u'max_either': <django.utils.functional.__proxy__ object at 0x7f7445fa4a50>, u'invalid': <django.utils.functional.__proxy__ object at 0x7f7445fa4390>}
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