scipost.fields module

class scipost.fields.ChoiceArrayField(base_field, size=None, **kwargs)[source]

Bases: django.contrib.postgres.fields.array.ArrayField

A field that allows us to store an array of choices. Uses Django 1.9’s postgres ArrayField and a MultipleChoiceField for its formfield.

formfield(**kwargs)[source]

Return a django.forms.Field instance for this field.

class scipost.fields.ReCaptchaField(use_ssl=None, attrs=None, *args, **kwargs)[source]

Bases: django.forms.fields.CharField

default_error_messages = {'captcha_error': 'Error verifying input, please try again.', 'captcha_invalid': 'Incorrect, please try again.'}
clean(values)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class scipost.fields.UserModelChoiceField(queryset, *, empty_label='---------', required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, blank=False, **kwargs)[source]

Bases: django.forms.models.ModelChoiceField

label_from_instance(obj)[source]

Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices.