Base class for all criteria.
Attributes:
Constants:
A list of operators which can be returned from get_operators.
[
[EQUAL, _(u"Equal to")],
[LESS_THAN, _(u"Less than")],
[LESS_THAN_EQUAL, _(u"Less than equal to")],
[GREATER_THAN, _(u"Greater than")],
[GREATER_THAN_EQUAL, _(u"Greater than equal to")],
]
A list of operators which can be returned from get_operators.
[
[IS_SELECTED, _(u"Is selected")],
[IS_NOT_SELECTED, _(u"Is not selected")],
]
A list of operators which can be returned from get_operators.
[
[IS_VALID, _(u"Is valid")],
[IS_NOT_VALID, _(u"Is not valid")],
]
A list of operators which can be return from get_operators.
[
[EQUAL, _(u"Equal to")],
[CONTAINS, _(u"Contains")],
]
Returns the selectable operators of the criterion which are displayed to the shop manager. This is a list of list, whereas the the first value is integer, which is stored within the criterion and the second value is the string which is displayed to the shop manager, e.g.:
[
[0, _(u"Equal to")],
[1, _(u"Less than")],
[2, _(u"Less than equal to")],
[3, _(u"Greater than")],
[4, _(u"Greater than equal to")],
]
Note
You can use one of the provided class attributes, see above.
Returns the selectable values as a list of dictionary, see below. This is only called when get_value_type returns SELECT or MULTIPLE_SELECT.
[
{
"id": 0,
"name": "Name 0",
"selected": False,
},
{
"id": 1,
"name": "Name 1",
"selected": True,
},
]
Returns the template to render the criterion.
Returns the type of the selectable values field. Must return one of:
Returns the current value of the criterion.
Returns True if the criterion is valid otherwise False.
Renders the criterion as html in order to displayed it within the management form.
Updates the value of the criterion.
Parameters: