:py:mod:`oioioi.base.forms` =========================== .. py:module:: oioioi.base.forms Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.base.forms.CustomCaptchaTextInput oioioi.base.forms.RegistrationFormWithNames oioioi.base.forms.UserForm oioioi.base.forms.OioioiUserForm oioioi.base.forms.OioioiUserCreationForm oioioi.base.forms.OioioiUserChangeForm oioioi.base.forms.OioioiPasswordResetForm oioioi.base.forms.AlwaysChangedModelForm Functions ~~~~~~~~~ .. autoapisummary:: oioioi.base.forms.adjust_username_field oioioi.base.forms.adjust_name_fields oioioi.base.forms.adjust_unicode_field oioioi.base.forms.get_consent oioioi.base.forms._maybe_add_field oioioi.base.forms.adjust_preferences_factory_fields oioioi.base.forms.handle_new_preference_fields oioioi.base.forms.save_consents .. py:function:: adjust_username_field(form) .. py:function:: adjust_name_fields(form) .. py:function:: adjust_unicode_field(form, field_name, help_text, invalid_message, unicode_categories=None, allow_spaces=True) .. py:function:: get_consent(field_name, user) .. py:function:: _maybe_add_field(label, *args, **kwargs) .. py:function:: adjust_preferences_factory_fields() .. py:function:: handle_new_preference_fields(request, user) .. py:function:: save_consents(sender, user, **kwargs) .. py:class:: CustomCaptchaTextInput(attrs=None, field_template=None, id_prefix=None, generator=None, output_format=None) Bases: :py:obj:`captcha.fields.CaptchaTextInput` Base class for Captcha widgets .. py:attribute:: template_name :annotation: = captcha/custom_field.html .. py:class:: RegistrationFormWithNames(*args, **kwargs) Bases: :py:obj:`registration.forms.RegistrationForm` Form for registering a new user account. Validates that the requested username is not already in use, and requires the password to be entered twice to catch typos. Subclasses should feel free to add any additional validation they need, but should avoid defining a ``save()`` method -- the actual saving of collected user data is delegated to the active registration backend. .. py:class:: Media Bases: :py:obj:`object` .. py:attribute:: js :annotation: = ['js/refresh-simple-captcha.js'] .. py:class:: UserForm(*args, **kwargs) Bases: :py:obj:`django.forms.ModelForm` The main implementation of all the Form logic. Note that this class is different than Form. See the comments by the Form class for more info. Any improvements to the form API should be made to this class, not to the Form class. .. py:class:: Meta Bases: :py:obj:`object` .. py:attribute:: model .. py:attribute:: fields :annotation: = ['username', 'first_name', 'last_name', 'email'] .. py:method:: clean_username() .. py:method:: save(*args, **kwargs) Save this form's self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance. .. py:class:: OioioiUserForm(*args, **kwargs) Bases: :py:obj:`UserForm` The main implementation of all the Form logic. Note that this class is different than Form. See the comments by the Form class for more info. Any improvements to the form API should be made to this class, not to the Form class. .. py:class:: Media Bases: :py:obj:`object` .. py:attribute:: js :annotation: = ['js/email-change.js'] .. py:attribute:: confirm_password .. py:method:: clean_confirm_password() .. py:class:: OioioiUserCreationForm(*args, **kwargs) Bases: :py:obj:`django.contrib.auth.forms.UserCreationForm` A form that creates a user, with no privileges, from the given username and password. .. py:class:: OioioiUserChangeForm(*args, **kwargs) Bases: :py:obj:`django.contrib.auth.forms.UserChangeForm` The main implementation of all the Form logic. Note that this class is different than Form. See the comments by the Form class for more info. Any improvements to the form API should be made to this class, not to the Form class. .. py:class:: OioioiPasswordResetForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None) Bases: :py:obj:`django.contrib.auth.forms.PasswordResetForm` A collection of Fields, plus their associated data. .. py:attribute:: error_messages .. py:method:: clean_email() Validates that an active user exists with the given email address. .. py:class:: AlwaysChangedModelForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None) Bases: :py:obj:`django.forms.ModelForm` The main implementation of all the Form logic. Note that this class is different than Form. See the comments by the Form class for more info. Any improvements to the form API should be made to this class, not to the Form class. .. py:method:: has_changed() By always returning True even unchanged inlines will get saved.