oioioi.contests.forms

Module Contents

Classes

SimpleContestForm

The main implementation of all the Form logic. Note that this class is

ProblemInstanceForm

The main implementation of all the Form logic. Note that this class is

SubmissionForm

Represents base submission form containing task selector.

SubmissionFormForProblemInstance

Represents base submission form containing task selector.

GetUserInfoForm

A collection of Fields, plus their associated data.

TestsSelectionForm

A collection of Fields, plus their associated data.

class oioioi.contests.forms.SimpleContestForm(*args, **kwargs)[source]

Bases: 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.

class Meta[source]

Bases: object

model[source]
fields = ['controller_name', 'name', 'id'][source]
start_date[source]
end_date[source]
results_date[source]
_generate_default_dates()[source]
_set_dates(round)[source]
clean()[source]

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__’.

save(commit=True)[source]

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.

class oioioi.contests.forms.ProblemInstanceForm(*args, **kwargs)[source]

Bases: 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.

class oioioi.contests.forms.SubmissionForm(request, *args, **kwargs)[source]

Bases: 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.

property media[source]

Return all media required to render the widgets on this form.

problem_instance_id[source]
_js = ['common/submit.js'][source]
move_field_to_end(field_name)[source]
set_custom_field_attributes(field_name, problem_instance)[source]

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

hide_default_fields(problem_instance)[source]

Hide default form fields for a given problem instance. :param problem_instance: Problem instance which will have fields hidden

_set_field_show_always(field_name)[source]
_set_default_fields_attributes()[source]
get_problem_instances()[source]
is_valid()[source]

Return True if the form has no errors, or False otherwise.

clean(check_submission_limit=True, check_round_times=True)[source]

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__’.

class oioioi.contests.forms.SubmissionFormForProblemInstance(request, problem_instance, *args, **kwargs)[source]

Bases: 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.

get_problem_instances()[source]
class oioioi.contests.forms.GetUserInfoForm(request, *args, **kwargs)[source]

Bases: django.forms.Form

A collection of Fields, plus their associated data.

user[source]
class oioioi.contests.forms.TestsSelectionForm(request, queryset, pis_count, uses_is_active, *args, **kwargs)[source]

Bases: django.forms.Form

A collection of Fields, plus their associated data.