:py:mod:`oioioi.contests.forms` =============================== .. py:module:: oioioi.contests.forms Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.contests.forms.SimpleContestForm oioioi.contests.forms.ProblemInstanceForm oioioi.contests.forms.SubmissionForm oioioi.contests.forms.SubmissionFormForProblemInstance oioioi.contests.forms.GetUserInfoForm oioioi.contests.forms.TestsSelectionForm .. py:class:: SimpleContestForm(*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: = ['controller_name', 'name', 'id'] .. py:attribute:: start_date .. py:attribute:: end_date .. py:attribute:: results_date .. py:method:: _generate_default_dates() .. py:method:: _set_dates(round) .. py:method:: clean() Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named '__all__'. .. py:method:: save(commit=True) 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:: ProblemInstanceForm(*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:: SubmissionForm(request, *args, **kwargs) Bases: :py:obj:`django.forms.Form` Represents base submission form containing task selector. Recognized optional ``**kwargs`` fields: * ``problem_filter`` Function filtering submittable tasks. * ``kind`` Kind of submission accessible with ``kind`` property. * ``problem_instance`` When SubmissionForm is used only for one problem_instance. Otherwise ``problem_instance`` is None. * ``add_kind_and_user_fields`` Option deciding whether form should add kind and user fields to itself. .. py:property:: media Return all media required to render the widgets on this form. .. py:attribute:: problem_instance_id .. py:attribute:: _js :annotation: = ['common/submit.js'] .. py:method:: move_field_to_end(field_name) .. py:method:: set_custom_field_attributes(field_name, problem_instance) Prepare custom field to be displayed only for a specific problems. Still all custom fields need to have unique names (best practice is to prefix them with `problem_instance.id`). :param field_name: Name of custom field :param problem_instance: Problem instance which they are assigned to .. py:method:: hide_default_fields(problem_instance) Hide default form fields for a given problem instance. :param problem_instance: Problem instance which will have fields hidden .. py:method:: _set_field_show_always(field_name) .. py:method:: _set_default_fields_attributes() .. py:method:: get_problem_instances() .. py:method:: is_valid() Return True if the form has no errors, or False otherwise. .. py:method:: clean(check_submission_limit=True, check_round_times=True) Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named '__all__'. .. py:class:: SubmissionFormForProblemInstance(request, problem_instance, *args, **kwargs) Bases: :py:obj:`SubmissionForm` Represents base submission form containing task selector. Recognized optional ``**kwargs`` fields: * ``problem_filter`` Function filtering submittable tasks. * ``kind`` Kind of submission accessible with ``kind`` property. * ``problem_instance`` When SubmissionForm is used only for one problem_instance. Otherwise ``problem_instance`` is None. * ``add_kind_and_user_fields`` Option deciding whether form should add kind and user fields to itself. .. py:method:: get_problem_instances() .. py:class:: GetUserInfoForm(request, *args, **kwargs) Bases: :py:obj:`django.forms.Form` A collection of Fields, plus their associated data. .. py:attribute:: user .. py:class:: TestsSelectionForm(request, queryset, pis_count, uses_is_active, *args, **kwargs) Bases: :py:obj:`django.forms.Form` A collection of Fields, plus their associated data.