Models

database structure

Database structural image

Athlete

class results.models.athletes.Athlete(*args, **kwargs)

Stores a single athlete.

Related to

Gender and date of birth are used for the result validation.

Parameters
  • id (AutoField) – Id

  • first_name (CharField) – First name

  • last_name (CharField) – Last name

  • sport_id (CharField) – Sport id

  • date_of_birth (DateField) – Date of birth

  • gender (CharField) – Gender

  • organization (ForeignKey to Organization) – Organization

  • no_auto_update (BooleanField) – No automatic updates

  • additional_organizations (ManyToManyField) – Additional organizations

exception DoesNotExist
exception MultipleObjectsReturned

AthleteInformation

class results.models.athletes.AthleteInformation(*args, **kwargs)

Stores a single athlete specific information.

Related to
Parameters
  • id (AutoField) – Id

  • athlete (ForeignKey to Athlete) – Athlete

  • type (CharField) – Type

  • value (CharField) – Value

  • date_start (DateField) – Start date

  • date_end (DateField) – End date

  • visibility (CharField) – Visibility

  • modification_time (DateTimeField) – Suomisport update timestamp

exception DoesNotExist
exception MultipleObjectsReturned

Category

class results.models.categories.Category(*args, **kwargs)

Stores a single category.

Related to

Defined values for a gender are M (Man), W (Woman), O (Other/Unknown).

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • abbreviation (CharField) – Abbreviation

  • division (ForeignKey to Division) – Division

  • sport (ForeignKey to Sport) – Sport

  • max_age (SmallIntegerField) – Maximum age

  • min_age (SmallIntegerField) – Minimum age

  • age_exact (BooleanField) – Age limit checked by the exact day, not year

  • team (BooleanField) – Team category

  • team_size (SmallIntegerField) – Number of team members

  • gender (CharField) – Gender

  • order (SmallIntegerField) – Order

  • historical (BooleanField) – Historical

exception DoesNotExist
exception MultipleObjectsReturned

CategoryForCompetitionType

class results.models.categories.CategoryForCompetitionType(*args, **kwargs)

Stores a single competition type and category validation check.

Related to
Parameters
  • id (AutoField) – Id

  • category (ForeignKey to Category) – Category

  • type (ForeignKey to CompetitionType) – Type

  • max_result (SmallIntegerField) – Maximum result

  • min_result (SmallIntegerField) – Minimum result

  • disallow (BooleanField) – Disallow category for this competition type

  • check_record (BooleanField) – Check records

  • record_group (SmallIntegerField) – Record group

exception DoesNotExist
exception MultipleObjectsReturned

Division

class results.models.categories.Division(*args, **kwargs)

Stores a single division.

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • abbreviation (CharField) – Abbreviation

  • historical (BooleanField) – Historical

exception DoesNotExist
exception MultipleObjectsReturned

Competition

class results.models.competitions.Competition(*args, **kwargs)

Stores a single competition.

Related to
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • description (TextField) – Description

  • date_start (DateField) – Start date

  • date_end (DateField) – End date

  • location (CharField) – Location

  • event (ForeignKey to Event) – Event

  • organization (ForeignKey to Organization) – Organization

  • type (ForeignKey to CompetitionType) – Type

  • level (ForeignKey to CompetitionLevel) – Level

  • layout (SmallIntegerField) – Layout type

  • locked (BooleanField) – Edit lock

  • public (BooleanField) – Public

  • trial (BooleanField) – Trial competition

exception DoesNotExist
exception MultipleObjectsReturned

CompetitionLayout

class results.models.competitions.CompetitionLayout(*args, **kwargs)

Stores a single competition layout.

Related to
Parameters
  • id (AutoField) – Id

  • type (SmallIntegerField) – Layout type

  • label (CharField) – Label

  • name (CharField) – Result type name

  • block (SmallIntegerField) – Block

  • row (SmallIntegerField) – Row

  • col (SmallIntegerField) – Column

  • order (SmallIntegerField) – Order

  • hide (CharField) – Hide on smaller screen

  • show (CharField) – Show on larger screen

exception DoesNotExist
exception MultipleObjectsReturned

CompetitionLevel

class results.models.competitions.CompetitionLevel(*args, **kwargs)

Stores a single competition level.

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • abbreviation (CharField) – Abbreviation

  • order (SmallIntegerField) – Order

  • requirements (CharField) – Requirements

  • historical (BooleanField) – Historical

exception DoesNotExist
exception MultipleObjectsReturned

CompetitionResultType

class results.models.competitions.CompetitionResultType(*args, **kwargs)

Stores a single result type.

Related to
Parameters
  • id (AutoField) – Id

  • competition_type (ForeignKey to CompetitionType) – Competition type

  • name (CharField) – Name

  • abbreviation (CharField) – Abbreviation

  • max_result (SmallIntegerField) – Maximum result

  • min_result (SmallIntegerField) – Minimum result

  • records (BooleanField) – Check records

exception DoesNotExist
exception MultipleObjectsReturned

CompetitionType

class results.models.competitions.CompetitionType(*args, **kwargs)

Stores a single competition type.

Related to
  • categories.Sport

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • abbreviation (CharField) – Abbreviation

  • sport (ForeignKey to Sport) – Sport

  • number_of_rounds (SmallIntegerField) – Number of rounds

  • max_result (SmallIntegerField) – Maximum result

  • min_result (SmallIntegerField) – Minimum result

  • order (SmallIntegerField) – Order

  • requirements (CharField) – Requirements

  • personal (BooleanField) – Personal competition

  • team (BooleanField) – Team competition

  • layout (SmallIntegerField) – Layout type

  • historical (BooleanField) – Historical

exception DoesNotExist
exception MultipleObjectsReturned

Event

class results.models.events.Event(*args, **kwargs)

Stores a single event.

Related to - organization.Organization

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • description (TextField) – Description

  • date_start (DateField) – Start date

  • date_end (DateField) – End date

  • location (CharField) – Location

  • organization (ForeignKey to Organization) – Organization

  • locked (BooleanField) – Edit lock

  • public (BooleanField) – Public

exception DoesNotExist
exception MultipleObjectsReturned

Area

class results.models.organizations.Area(*args, **kwargs)

Stores a single organizational area.

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • abbreviation (CharField) – Abbreviation

exception DoesNotExist
exception MultipleObjectsReturned

Organization

class results.models.organizations.Organization(*args, **kwargs)

Stores a single organization.

Related to
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • abbreviation (CharField) – Abbreviation

  • external (BooleanField) – External

  • group (OneToOneField to Group) – Group

  • sport_id (CharField) – Sport id

  • historical (BooleanField) – Historical

  • areas (ManyToManyField) – Areas

exception DoesNotExist
exception MultipleObjectsReturned

Record

class results.models.records.Record(*args, **kwargs)

Stores a single record.

Related to
Parameters
  • id (AutoField) – Id

  • result (ForeignKey to Result) – Result

  • partial_result (ForeignKey to ResultPartial) – Partial result

  • level (ForeignKey to RecordLevel) – Level

  • type (ForeignKey to CompetitionType) – Type

  • category (ForeignKey to Category) – Category

  • approved (BooleanField) – Approved

  • date_start (DateField) – Start date

  • date_end (DateField) – End date

  • info (TextField) – Info

  • historical (BooleanField) – Historical

exception DoesNotExist
exception MultipleObjectsReturned
save(*args, **kwargs)

When saved, end approved and delete unapproved lower records.

RecordLevel

class results.models.records.RecordLevel(*args, **kwargs)

Stores a single record level.

Related to
Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • abbreviation (CharField) – Abbreviation

  • area (ForeignKey to Area) – Area

  • base (BooleanField) – Base results

  • partial (BooleanField) – Partial results

  • personal (BooleanField) – Personal

  • team (BooleanField) – Team

  • decimals (BooleanField) – Decimals

  • order (SmallIntegerField) – Order

  • historical (BooleanField) – Historical

  • levels (ManyToManyField) – Levels

  • types (ManyToManyField) – Types

exception DoesNotExist
exception MultipleObjectsReturned

Result

class results.models.results.Result(*args, **kwargs)

Stores a single result.

Related to
Parameters
  • id (AutoField) – Id

  • competition (ForeignKey to Competition) – Competition

  • athlete (ForeignKey to Athlete) – Athlete

  • first_name (CharField) – First name

  • last_name (CharField) – Last name

  • organization (ForeignKey to Organization) – Organization

  • category (ForeignKey to Category) – Category

  • elimination_category (ForeignKey to Category) – Elimination category

  • result (DecimalField) – Result

  • result_code (CharField) – Result code

  • decimals (SmallIntegerField) – Result decimals

  • position (SmallIntegerField) – Position

  • position_pre (SmallIntegerField) – Preliminary position

  • approved (BooleanField) – Approved

  • info (CharField) – Additional information

  • admin_info (CharField) – Administrational information

  • team (BooleanField) – Team result

  • team_members (ManyToManyField) – Team members

exception DoesNotExist
exception MultipleObjectsReturned
save(*args, **kwargs)

Add result names from the athlete if not included. Set position_pre as position if not included and vice versa.

ResultPartial

class results.models.results.ResultPartial(*args, **kwargs)

Stores a single partial result.

Related to
Parameters
  • id (AutoField) – Id

  • result (ForeignKey to Result) – Result

  • type (ForeignKey to CompetitionResultType) – Type

  • order (SmallIntegerField) – Order

  • value (DecimalField) – Value

  • decimals (SmallIntegerField) – Value decimals

  • time (DateTimeField) – Time

exception DoesNotExist
exception MultipleObjectsReturned

Sport

class results.models.sports.Sport(*args, **kwargs)

Stores a single sport.

Parameters
  • id (AutoField) – Id

  • name (CharField) – Name

  • abbreviation (CharField) – Abbreviation

  • order (SmallIntegerField) – Order

  • historical (BooleanField) – Historical

exception DoesNotExist
exception MultipleObjectsReturned