Working 1.0
This commit is contained in:
parent
b3f0d2a966
commit
a10fce5731
6
.env.example
Normal file
6
.env.example
Normal file
@ -0,0 +1,6 @@
|
||||
DJANGO_SECRET_KEY=
|
||||
DB_NAME=trafoking
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=postgres
|
||||
DB_HOST=db
|
||||
DB_PORT=5432
|
163
.gitignore
vendored
163
.gitignore
vendored
@ -1,162 +1,3 @@
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
.env
|
||||
staticfiles/
|
BIN
apps/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
apps/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/core/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
apps/core/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/core/__pycache__/admin.cpython-311.pyc
Normal file
BIN
apps/core/__pycache__/admin.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/core/__pycache__/apps.cpython-311.pyc
Normal file
BIN
apps/core/__pycache__/apps.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/core/__pycache__/models.cpython-311.pyc
Normal file
BIN
apps/core/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/core/migrations/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
apps/core/migrations/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/participants/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
apps/participants/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/participants/__pycache__/admin.cpython-311.pyc
Normal file
BIN
apps/participants/__pycache__/admin.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/participants/__pycache__/apps.cpython-311.pyc
Normal file
BIN
apps/participants/__pycache__/apps.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/participants/__pycache__/forms.cpython-311.pyc
Normal file
BIN
apps/participants/__pycache__/forms.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/participants/__pycache__/models.cpython-311.pyc
Normal file
BIN
apps/participants/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/participants/__pycache__/services.cpython-311.pyc
Normal file
BIN
apps/participants/__pycache__/services.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/participants/__pycache__/urls.cpython-311.pyc
Normal file
BIN
apps/participants/__pycache__/urls.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/participants/__pycache__/views.cpython-311.pyc
Normal file
BIN
apps/participants/__pycache__/views.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,7 +2,7 @@ from django.urls import path
|
||||
from .views import ParticipantCreateView, CalculateView, ResultsView
|
||||
|
||||
urlpatterns = [
|
||||
path("", ParticipantCreateView.as_view(), name="participant_new"),
|
||||
path("calcular/", CalculateView.as_view(), name="calculate"),
|
||||
path("resultados/", ResultsView.as_view(), name="results"),
|
||||
path("", ParticipantCreateView.as_view(), name="participant_new"),
|
||||
path("calcular/", CalculateView.as_view(), name="calculate"),
|
||||
path("resultados/",ResultsView.as_view(), name="results"),
|
||||
]
|
||||
|
BIN
apps/settingsapp/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
apps/settingsapp/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/settingsapp/__pycache__/admin.cpython-311.pyc
Normal file
BIN
apps/settingsapp/__pycache__/admin.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/settingsapp/__pycache__/apps.cpython-311.pyc
Normal file
BIN
apps/settingsapp/__pycache__/apps.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/settingsapp/__pycache__/forms.cpython-311.pyc
Normal file
BIN
apps/settingsapp/__pycache__/forms.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/settingsapp/__pycache__/models.cpython-311.pyc
Normal file
BIN
apps/settingsapp/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/settingsapp/__pycache__/urls.cpython-311.pyc
Normal file
BIN
apps/settingsapp/__pycache__/urls.cpython-311.pyc
Normal file
Binary file not shown.
BIN
apps/settingsapp/__pycache__/views.cpython-311.pyc
Normal file
BIN
apps/settingsapp/__pycache__/views.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
apps/settingsapp/migrations/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
apps/settingsapp/migrations/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
db.sqlite3
Normal file
BIN
db.sqlite3
Normal file
Binary file not shown.
39
static/css/styles.css
Normal file
39
static/css/styles.css
Normal file
@ -0,0 +1,39 @@
|
||||
/* static/css/styles.css */
|
||||
:root{
|
||||
--brand-blue:#002e5d;
|
||||
--brand-yellow:#f4b400;
|
||||
--brand-orange:#ffa94d;
|
||||
}
|
||||
|
||||
body{background:var(--brand-blue);color:#fff;font-family:Inter,system-ui,sans-serif}
|
||||
|
||||
/*–– Botones ––*/
|
||||
.btn{
|
||||
@apply inline-block px-6 py-3 rounded-xl font-medium transition transform;
|
||||
}
|
||||
.btn-primary{
|
||||
background:var(--brand-orange);color:#222;
|
||||
}
|
||||
.btn-primary:hover{filter:brightness(1.1) scale(1.02)}
|
||||
.btn-secondary{
|
||||
background:transparent;border:2px solid var(--brand-orange);color:var(--brand-orange);
|
||||
}
|
||||
.btn-secondary:hover{background:var(--brand-orange);color:#222}
|
||||
|
||||
/*–– Animaciones hero ––*/
|
||||
@keyframes scaleFade{
|
||||
0%{opacity:0;transform:scale(.7)}
|
||||
100%{opacity:1;transform:scale(1)}
|
||||
}
|
||||
.hero-appear{animation:scaleFade .6s ease-out both}
|
||||
|
||||
/*–– Transición logo grande→pequeño ––*/
|
||||
.logo-big {width: 60%}
|
||||
.logo-small {width:48px}
|
||||
|
||||
/*–– Table ––*/
|
||||
table{border-collapse:collapse;width:100%;max-width:640px;margin-inline:auto}
|
||||
th,td{padding:.6rem 1rem;border-bottom:1px solid #ffffff33}
|
||||
thead{background:#ffffff11}
|
||||
tbody tr:nth-child(even){background:#ffffff08}
|
||||
|
BIN
static/img/logo.png
Normal file
BIN
static/img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 437 KiB |
@ -1,9 +1,10 @@
|
||||
<!-- templates/auth/login.html -->
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Login · Trafoking{% endblock %}
|
||||
{% block content %}
|
||||
<form method="post" class="space-y-2">
|
||||
<form method="post" class="space-y-4 w-full max-w-xs hero-appear">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button class="px-4 py-2 bg-amber-500 rounded">Entrar</button>
|
||||
<button class="btn btn-primary w-full">Entrar</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
@ -1,14 +1,36 @@
|
||||
<!-- templates/base.html -->
|
||||
{% load static %}
|
||||
<!doctype html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Trafoking</title>
|
||||
<script src="https://unpkg.com/htmx.org@1.9.12"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@3.4.1/dist/tailwind.min.css">
|
||||
<title>{% block title %}Trafoking{% endblock %}</title>
|
||||
|
||||
<!-- Tailwind (CDN) -->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="{% static 'css/styles.css' %}">
|
||||
</head>
|
||||
<body class="min-h-screen bg-slate-900 text-slate-100 flex flex-col items-center py-8">
|
||||
<h1 class="text-4xl font-bold mb-4">Trafoking ⚡👑</h1>
|
||||
{% block content %}{% endblock %}
|
||||
<body class="min-h-screen flex flex-col">
|
||||
|
||||
<!-- NAVBAR -->
|
||||
<header class="flex items-center gap-4 px-6 py-4">
|
||||
<a href="/" aria-label="Inicio">
|
||||
<img src="{% static 'img/logo.png' %}" class="logo-small"/>
|
||||
</a>
|
||||
<nav class="flex-1 flex gap-3">
|
||||
<a href="{% url 'participant_new' %}" class="btn btn-secondary hidden sm:inline-block">Concurso</a>
|
||||
<a href="{% url 'settings' %}" class="btn btn-secondary hidden sm:inline-block">Administración</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!-- CONTENIDO -->
|
||||
<main class="flex-1 flex flex-col items-center justify-center px-4">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<!-- FOOTER -->
|
||||
<footer class="text-center text-xs py-3 opacity-50">
|
||||
© {{year|default:"2025"}} Trafoking
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
20
templates/home.html
Normal file
20
templates/home.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!-- templates/home.html -->
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% block title %}Trafoking{% endblock %}
|
||||
{% block content %}
|
||||
<section class="flex flex-col items-center text-center gap-12 hero-appear">
|
||||
|
||||
<img src="{% static 'img/logo.png' %}" class="logo-big drop-shadow-lg"/>
|
||||
|
||||
<div class="flex flex-col sm:flex-row gap-6">
|
||||
<a href="{% url 'participant_new' %}" class="btn btn-primary text-lg">
|
||||
Empezar concurso
|
||||
</a>
|
||||
<a href="{% url 'settings' %}" class="btn btn-primary text-lg">
|
||||
Administración
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
{% endblock %}
|
@ -1,21 +1,22 @@
|
||||
<!-- templates/participants/form.html -->
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Añadir grupo · Trafoking{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<!-- Form: añadir grupo -->
|
||||
<form method="post" action="" class="space-y-2">
|
||||
<h2 class="text-3xl font-bold mb-6 text-[color:var(--brand-yellow)]">
|
||||
Añadir participante
|
||||
</h2>
|
||||
|
||||
<form method="post" class="space-y-4 w-full max-w-md">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button class="px-4 py-2 bg-amber-500 rounded">
|
||||
Añadir
|
||||
</button>
|
||||
<button class="btn btn-primary w-full"> Añadir </button>
|
||||
</form>
|
||||
|
||||
<!-- Botón único: calcula + redirige al ranking -->
|
||||
<form method="post" action="{% url 'calculate' %}" class="mt-4">
|
||||
<form method="post" action="{% url 'calculate' %}" class="mt-8">
|
||||
{% csrf_token %}
|
||||
<button class="px-4 py-2 bg-lime-600 rounded">
|
||||
Calcular y mostrar ranking
|
||||
<button class="btn btn-secondary w-full">
|
||||
Calcular y mostrar ranking
|
||||
</button>
|
||||
</form>
|
||||
|
||||
|
@ -1,18 +1,27 @@
|
||||
<!-- templates/participants/results.html -->
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Resultados · Trafoking{% endblock %}
|
||||
{% block content %}
|
||||
<table class="table-auto border-collapse">
|
||||
|
||||
<h2 class="text-3xl font-bold mb-8 text-[color:var(--brand-yellow)]">Ranking</h2>
|
||||
|
||||
<table class="hero-appear">
|
||||
<thead><tr><th>#</th><th>Grupo</th><th>Puntuación</th></tr></thead>
|
||||
<tbody>
|
||||
{% for p in participants %}
|
||||
<tr class="text-center">
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td>{{ p.group_name }}</td>
|
||||
<td>{{ p.score|floatformat:2 }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="3">Sin participantes todavía.</td></tr>
|
||||
{% endfor %}
|
||||
{% for p in participants %}
|
||||
<tr class="text-center">
|
||||
<td>{{forloop.counter}}</td>
|
||||
<td class="font-semibold">{{p.group_name}}</td>
|
||||
<td>{{p.score|floatformat:2}}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="3">Sin participantes todavía.</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{% url 'participant_new' %}" class="btn btn-primary mt-10">
|
||||
Añadir más grupos
|
||||
</a>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,10 +1,16 @@
|
||||
<!-- templates/settingsapp/form.html -->
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Ajustes · Trafoking{% endblock %}
|
||||
{% block content %}
|
||||
<h2 class="text-2xl mb-4">Ajustes de calificación</h2>
|
||||
<form method="post" class="space-y-2">
|
||||
|
||||
<h2 class="text-3xl font-bold mb-6 text-[color:var(--brand-yellow)]">
|
||||
Ajustes de calificación
|
||||
</h2>
|
||||
|
||||
<form method="post" class="grid gap-4 w-full max-w-lg">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button class="px-4 py-2 bg-amber-500 rounded">Guardar</button>
|
||||
<button class="btn btn-primary w-full">Guardar</button>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
BIN
trafoking/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
trafoking/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
trafoking/__pycache__/settings.cpython-311.pyc
Normal file
BIN
trafoking/__pycache__/settings.cpython-311.pyc
Normal file
Binary file not shown.
BIN
trafoking/__pycache__/urls.cpython-311.pyc
Normal file
BIN
trafoking/__pycache__/urls.cpython-311.pyc
Normal file
Binary file not shown.
BIN
trafoking/__pycache__/wsgi.cpython-311.pyc
Normal file
BIN
trafoking/__pycache__/wsgi.cpython-311.pyc
Normal file
Binary file not shown.
@ -7,7 +7,7 @@ load_dotenv()
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
SECRET_KEY = os.getenv("DJANGO_SECRET_KEY")
|
||||
DEBUG = False
|
||||
DEBUG = True
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
|
||||
INSTALLED_APPS = [
|
||||
@ -80,6 +80,7 @@ USE_I18N = USE_L10N = USE_TZ = True
|
||||
|
||||
STATIC_URL = "/static/"
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
STATICFILES_DIRS = [ BASE_DIR / "static" ]
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
LOGIN_URL = "/login/"
|
||||
LOGIN_REDIRECT_URL = "/"
|
||||
|
@ -1,11 +1,14 @@
|
||||
# trafoking/urls.py
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.views.generic import TemplateView
|
||||
from django.contrib.auth.views import LoginView, LogoutView
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
path("login/", LoginView.as_view(template_name="auth/login.html"), name="login"),
|
||||
path("logout/", LogoutView.as_view(), name="logout"),
|
||||
path("", include("apps.participants.urls")),
|
||||
path("", TemplateView.as_view(template_name="home.html"), name="home"),
|
||||
path("concurso/", include("apps.participants.urls")), # ‹— cambiamos prefijo
|
||||
path("ajustes/", include("apps.settingsapp.urls")),
|
||||
path("login/", LoginView.as_view(template_name="auth/login.html"), name="login"),
|
||||
path("logout/", LogoutView.as_view(), name="logout"),
|
||||
path("admin/", admin.site.urls),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user