This page documents every model field extracted from the source code. Fields are grouped by model. Optional fields are those defined with null=True or blank=True.
Torneo
Defined in torneo/models.py. Represents a tournament.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
nombre | CharField(100) | yes | Tournament name |
descripcion | TextField | no | Optional description |
organizador | FK → Organizador | yes | Owner; protected from deletion |
ganador | FK → Equipo | no | Set to NULL if the team is deleted |
max_equipos | PositiveIntegerField | yes | Maximum number of participating teams |
deporte | CharField(3) | yes | FUT · BAL · PAD |
tipo | CharField(3) | yes | LIG · ELI · ELG |
playoffs | BooleanField | yes | Whether the league includes a playoff phase (default False) |
n_equipos_playoffs | PositiveIntegerField | conditional | Required when playoffs=True; must be NULL when playoffs=False |
descenso | BooleanField | yes | Whether the league includes a relegation phase (default False) |
n_equipos_descenso | PositiveIntegerField | conditional | Required when descenso=True; must be NULL when descenso=False |
playoffs and descenso are only relevant for tipo=LIG tournaments. Database check constraints enforce that the corresponding count fields are set if and only if their feature flag is True.
TorneoEquipo
Defined in torneo/models.py. Join table between Torneo and Equipo.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
torneo | FK → Torneo | yes | Cascades on delete |
equipo | FK → Equipo | yes | Cascades on delete |
nivel | PositiveIntegerField | no | Seeding level 1–4 (choices: Nivel) |
Unique constraint: (torneo, equipo) — a team can only appear once in a tournament.
Jornada
Defined in torneo/models.py. A matchday in a league-type tournament.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
torneo | FK → Torneo | yes | Cascades on delete |
n_jornada | PositiveIntegerField | yes | Matchday number |
Unique constraint: (torneo, n_jornada) — matchday numbers are unique within a tournament.
Eliminatoria
Defined in torneo/models.py. Knockout bracket configuration for a tournament.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
torneo | FK → Torneo | yes | Cascades on delete |
rondas | PositiveIntegerField | yes | Number of rounds, 1–5 (default 1) |
Unique constraint: (torneo) — at most one Eliminatoria per tournament.
EliminatoriaGrupos
Defined in torneo/models.py. Group-stage configuration for a ELG-type tournament.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
torneo | FK → Torneo | yes | Cascades on delete |
eliminatoria | FK → Eliminatoria | no | The knockout phase this group stage feeds into; NULL until created |
n_clasificados_grupo | PositiveIntegerField | yes | Teams that advance from each group (≥ 1) |
n_grupos | PositiveIntegerField | yes | Number of groups, 1–32 |
Unique constraint: (torneo) — at most one EliminatoriaGrupos per tournament.
Clasificacion
Defined in torneo/models.py. One standings row for a team in a tournament (or group).
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
torneo_equipo | FK → TorneoEquipo | yes | Cascades on delete |
eliminatoria_grupos | FK → EliminatoriaGrupos | no | Scopes the row to a group stage; NULL for league-wide standings |
grupo | CharField(20) | yes | Group identifier; default "GENERAL" |
posicion | PositiveIntegerField | yes | Current rank within the group/table |
puntos | IntegerField | yes | Points total (default 0) |
victorias | PositiveIntegerField | yes | Wins (default 0) |
empates | PositiveIntegerField | yes | Draws (default 0) |
derrotas | PositiveIntegerField | yes | Losses (default 0) |
anotacion_favor | IntegerField | yes | Goals / points scored (default 0) |
anotacion_contra | IntegerField | yes | Goals / points conceded (default 0) |
Unique constraint: (torneo_equipo, grupo) — one standings row per team per group.
Equipo
Defined in equipo/models.py. A sports team.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
nombre | CharField(100) | yes | Team name; unique across all teams |
deporte | CharField(3) | yes | FUT · BAL · PAD |
user | OneToOne → User | yes | Linked Django user account; cascades on delete |
Administrador
Defined in usuario/models.py. Administrator profile.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
nombre | CharField(100) | yes | Display name |
user | OneToOne → User | yes | Linked Django user account; cascades on delete |
Organizador
Defined in usuario/models.py. Tournament organizer profile.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
nombre | CharField(100) | yes | Display name |
user | OneToOne → User | yes | Linked Django user account; cascades on delete |
Jugador
Defined in usuario/models.py. An individual player.
| Field | Type | Required | Notes |
|---|
dni | CharField(9) | yes | Primary key. Format: 8 digits followed by one uppercase letter (e.g. 12345678A) |
nombre | CharField(100) | yes | First name |
apellidos | CharField(150) | yes | Surname(s) |
es_portero | BooleanField | yes | True if the player is a goalkeeper (default False) |
user | OneToOne → User | yes | Linked Django user account; cascades on delete |
equipo | FK → Equipo | no | Team the player belongs to; set to NULL if the team is deleted |
dni is the primary key for Jugador. Django does not auto-generate an id column for this model.
Enfrentamiento
Defined in enfrentamiento/models.py. A single match.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
eliminatoria | FK → Eliminatoria | conditional | Set for knockout matches; mutually exclusive with jornada |
jornada | FK → Jornada | conditional | Set for league matchday matches; mutually exclusive with eliminatoria |
ronda | CharField(4) | no | Knockout round: 16AV · 8AV · CUA · SEM · FIN |
equipo_local | FK → Equipo | no | Home team; set to NULL if team is deleted |
equipo_visitante | FK → Equipo | no | Away team; set to NULL if team is deleted |
ganador | FK → Equipo | no | Match winner; must be equipo_local or equipo_visitante if set |
anotacion_local | PositiveIntegerField | no | Home score |
anotacion_visitante | PositiveIntegerField | no | Away score |
juegos_local_1 | PositiveIntegerField | no | Pádel: home games in set 1 |
juegos_visitante_1 | PositiveIntegerField | no | Pádel: away games in set 1 |
juegos_local_2 | PositiveIntegerField | no | Pádel: home games in set 2 |
juegos_visitante_2 | PositiveIntegerField | no | Pádel: away games in set 2 |
juegos_local_3 | PositiveIntegerField | no | Pádel: home games in set 3 |
juegos_visitante_3 | PositiveIntegerField | no | Pádel: away games in set 3 |
prev_local | FK → Enfrentamiento (self) | no | Previous match whose winner fills the home slot |
prev_visitante | FK → Enfrentamiento (self) | no | Previous match whose winner fills the away slot |
Database constraints:
- Exactly one of
eliminatoria or jornada must be non-null.
equipo_local and equipo_visitante must be different teams.
ganador must be NULL, equipo_local, or equipo_visitante.
EstadisticasFutbol
Defined in estadisticas/models.py. Aggregated football statistics for a player in a tournament.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
torneo | FK → Torneo | yes | Cascades on delete |
jugador | FK → Jugador | yes | Cascades on delete |
goles | PositiveIntegerField | yes | Goals scored (default 0) |
asistencias | PositiveIntegerField | yes | Assists (default 0) |
goles_contra | PositiveIntegerField | no | Goals conceded by the goalkeeper (default 0); NULL for non-goalkeepers |
Unique constraint: (torneo, jugador).
EstadisticasBaloncesto
Defined in estadisticas/models.py. Aggregated basketball statistics for a player in a tournament.
| Field | Type | Required | Notes |
|---|
id | BigAutoField | auto | Primary key |
torneo | FK → Torneo | yes | Cascades on delete |
jugador | FK → Jugador | yes | Cascades on delete |
puntos | PositiveIntegerField | yes | Points (default 0) |
rebotes | PositiveIntegerField | yes | Rebounds (default 0) |
asistencias | PositiveIntegerField | yes | Assists (default 0) |
Unique constraint: (torneo, jugador).
Enumeration types
All choices are defined in gestor/choices.py.
| Choice class | Values |
|---|
Deporte | FUT (Fútbol) · BAL (Baloncesto) · PAD (Pádel) |
TipoTorneo | LIG (Liga) · ELI (Eliminatoria) · ELG (Eliminatoria con Fase de Grupos) |
TipoRonda | 16AV · 8AV · CUA · SEM · FIN |
Nivel | 1 · 2 · 3 · 4 |
TipoUsuario | ADM · ORG · EQ · JUG |