oioioi.contests.date_registration

Module Contents

Classes

DateRegistry

Maintains a collection of important changeable date fields.

Attributes

class oioioi.contests.date_registration.DateRegistry[source]

Bases: object

Maintains a collection of important changeable date fields.

class DateItem(date_field, name_generator, round_chooser, qs_filter, model)[source]

Bases: object

register(date_field, name_generator=None, round_chooser=None, qs_filter=None, model=None, order=sys.maxsize)[source]

Registers a new date item.

Parameters
  • date_field – the date’s field in the model

  • name_generator – function taking model’s object and returning the name to be displayed with the date.

  • round_chooser – function taking model’s object and returning the round it belongs to.

  • qs_filter – function taking a (queryset, contest id) pair and returning a queryset limited to instances related to the contest.

  • model – the date’s model. If the model is not provided the method returns a decorator for a model.

  • order – the date’s order. The lower the order, the higher the priority of the date.

tolist(contest_id)[source]

Returns a list of items to pass to a template for rendering.

oioioi.contests.date_registration.date_registry[source]