Skip to main content
Gestor de Torneos organizes its data around four main concerns: user profiles, teams and players, tournaments, and match results with statistics. This page describes the principal entities and how they relate to each other.

Entity overview

EntityAppPurpose
Userdjango.contrib.authDjango built-in authentication user
AdministradorusuarioAdministrator profile linked to a User
OrganizadorusuarioOrganizer profile linked to a User
EquipoequipoTeam profile linked to a User
JugadorusuarioPlayer profile linked to a User, optionally belonging to an Equipo
TorneotorneoA tournament with a sport, type, and configuration
TorneoEquipotorneoJoin table between Torneo and Equipo (many-to-many with extra data)
JornadatorneoA matchday within a league-format tournament
EliminatoriatorneoKnockout bracket configuration for a tournament
EliminatoriaGrupostorneoGroup-stage configuration that leads into an Eliminatoria
ClasificaciontorneoStandings row for a TorneoEquipo, optionally scoped to a group
EnfrentamientoenfrentamientoA single match, belonging to either a Jornada or an Eliminatoria
EstadisticasFutbolestadisticasAggregated football stats per player per tournament
EstadisticasBaloncestoestadisticasAggregated basketball stats per player per tournament

Relationship map

User (django.contrib.auth)
 ├── Administrador       (one-to-one)
 ├── Organizador         (one-to-one)
 ├── Equipo              (one-to-one)
 │    └── Jugador[]      (many Jugadores belong to one Equipo)
 └── Jugador             (one-to-one)

Organizador
 └── Torneo[]            (one Organizador owns many Torneos)

Torneo
 ├── TorneoEquipo[]      (many-to-many bridge with Equipo, carries nivel)
 │    └── Clasificacion[]  (standings per team, per group)
 ├── Jornada[]           (league matchdays; type=LIG)
 │    └── Enfrentamiento[]
 ├── Eliminatoria        (one per tournament; type=ELI or phase of ELG)
 │    └── Enfrentamiento[]
 └── EliminatoriaGrupos  (one per tournament; type=ELG)
      └── Eliminatoria   (optional FK to the knockout phase)

Enfrentamiento
 ├── equipo_local   → Equipo
 ├── equipo_visitante → Equipo
 ├── ganador        → Equipo (nullable)
 ├── prev_local     → Enfrentamiento (self, bracket chaining)
 └── prev_visitante → Enfrentamiento (self, bracket chaining)

EstadisticasFutbol   → Torneo + Jugador (unique pair)
EstadisticasBaloncesto → Torneo + Jugador (unique pair)

User profiles

Every user in the system is a standard Django User. Role-specific data lives in a separate profile model linked via a OneToOneField:
  • Administrador — platform administrators.
  • Organizador — can create and manage tournaments.
  • Equipo — a team account; a single User represents the entire team.
  • Jugador — an individual player. Players optionally belong to an Equipo.
A User has at most one of each profile type at a time.

Tournaments

A Torneo belongs to an Organizador and has a sport (FUT, BAL, PAD) and a type:
Type codeNameStructure
LIGLigaRound-robin league with Jornadas
ELIEliminatoriaKnockout bracket only
ELGEliminatoria con Fase de GruposGroup stage feeding into a knockout bracket
Optional league features (playoffs, descenso) add a playoff or relegation phase on top of the league table.

Many-to-many: Torneo ↔ Equipo

TorneoEquipo is the explicit join table between Torneo and Equipo. It carries an optional nivel (1–4) that can be used to seed or rank teams. Each (torneo, equipo) pair is unique. Every TorneoEquipo record can have one or more Clasificacion rows — one per group the team participates in (defaulting to "GENERAL" for league-wide standings).

Match structure

An Enfrentamiento (match) always belongs to exactly one of:
  • A Jornada — for league rounds.
  • An Eliminatoria — for knockout matches.
The ronda field (16AV, 8AV, CUA, SEM, FIN) identifies the knockout round. Bracket progression is encoded with prev_local and prev_visitante self-referential foreign keys: the winner of a previous match populates the local or visiting slot of the next match. Pádel matches include per-set scores (juegos_local_1/juegos_visitante_1_3).

Statistics

Aggregated tournament statistics are stored per (Torneo, Jugador) pair:
  • EstadisticasFutbol — goals, assists, and goals conceded (goalkeeper stat).
  • EstadisticasBaloncesto — points, rebounds, assists.
Per-match stat entries are recorded in EstadisticasEnfrentamiento and GuardadoEnfrentamiento (draft/staging), both living in the enfrentamiento app.