diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..1035f1b --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +DJANGO_SECRET_KEY= +DB_NAME=trafoking +DB_USER=postgres +DB_PASSWORD=postgres +DB_HOST=db +DB_PORT=5432 diff --git a/.gitignore b/.gitignore index 5d381cc..040f087 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ \ No newline at end of file diff --git a/apps/__pycache__/__init__.cpython-311.pyc b/apps/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..34a9701 Binary files /dev/null and b/apps/__pycache__/__init__.cpython-311.pyc differ diff --git a/apps/core/__pycache__/__init__.cpython-311.pyc b/apps/core/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..bb18473 Binary files /dev/null and b/apps/core/__pycache__/__init__.cpython-311.pyc differ diff --git a/apps/core/__pycache__/admin.cpython-311.pyc b/apps/core/__pycache__/admin.cpython-311.pyc new file mode 100644 index 0000000..e25d02e Binary files /dev/null and b/apps/core/__pycache__/admin.cpython-311.pyc differ diff --git a/apps/core/__pycache__/apps.cpython-311.pyc b/apps/core/__pycache__/apps.cpython-311.pyc new file mode 100644 index 0000000..71a013b Binary files /dev/null and b/apps/core/__pycache__/apps.cpython-311.pyc differ diff --git a/apps/core/__pycache__/models.cpython-311.pyc b/apps/core/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000..83bb35d Binary files /dev/null and b/apps/core/__pycache__/models.cpython-311.pyc differ diff --git a/apps/core/migrations/__pycache__/__init__.cpython-311.pyc b/apps/core/migrations/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..6ec117e Binary files /dev/null and b/apps/core/migrations/__pycache__/__init__.cpython-311.pyc differ diff --git a/apps/participants/__pycache__/__init__.cpython-311.pyc b/apps/participants/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..d851821 Binary files /dev/null and b/apps/participants/__pycache__/__init__.cpython-311.pyc differ diff --git a/apps/participants/__pycache__/admin.cpython-311.pyc b/apps/participants/__pycache__/admin.cpython-311.pyc new file mode 100644 index 0000000..18497d5 Binary files /dev/null and b/apps/participants/__pycache__/admin.cpython-311.pyc differ diff --git a/apps/participants/__pycache__/apps.cpython-311.pyc b/apps/participants/__pycache__/apps.cpython-311.pyc new file mode 100644 index 0000000..1dd00f3 Binary files /dev/null and b/apps/participants/__pycache__/apps.cpython-311.pyc differ diff --git a/apps/participants/__pycache__/forms.cpython-311.pyc b/apps/participants/__pycache__/forms.cpython-311.pyc new file mode 100644 index 0000000..c882027 Binary files /dev/null and b/apps/participants/__pycache__/forms.cpython-311.pyc differ diff --git a/apps/participants/__pycache__/models.cpython-311.pyc b/apps/participants/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000..45cfc64 Binary files /dev/null and b/apps/participants/__pycache__/models.cpython-311.pyc differ diff --git a/apps/participants/__pycache__/services.cpython-311.pyc b/apps/participants/__pycache__/services.cpython-311.pyc new file mode 100644 index 0000000..38dc886 Binary files /dev/null and b/apps/participants/__pycache__/services.cpython-311.pyc differ diff --git a/apps/participants/__pycache__/urls.cpython-311.pyc b/apps/participants/__pycache__/urls.cpython-311.pyc new file mode 100644 index 0000000..dfc0358 Binary files /dev/null and b/apps/participants/__pycache__/urls.cpython-311.pyc differ diff --git a/apps/participants/__pycache__/views.cpython-311.pyc b/apps/participants/__pycache__/views.cpython-311.pyc new file mode 100644 index 0000000..84d91cb Binary files /dev/null and b/apps/participants/__pycache__/views.cpython-311.pyc differ diff --git a/apps/participants/migrations/__pycache__/0001_initial.cpython-311.pyc b/apps/participants/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..748015f Binary files /dev/null and b/apps/participants/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/apps/participants/migrations/__pycache__/__init__.cpython-311.pyc b/apps/participants/migrations/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..b861ceb Binary files /dev/null and b/apps/participants/migrations/__pycache__/__init__.cpython-311.pyc differ diff --git a/apps/participants/urls.py b/apps/participants/urls.py index 6ff159a..50bfa97 100644 --- a/apps/participants/urls.py +++ b/apps/participants/urls.py @@ -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"), ] diff --git a/apps/settingsapp/__pycache__/__init__.cpython-311.pyc b/apps/settingsapp/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..6d3b08c Binary files /dev/null and b/apps/settingsapp/__pycache__/__init__.cpython-311.pyc differ diff --git a/apps/settingsapp/__pycache__/admin.cpython-311.pyc b/apps/settingsapp/__pycache__/admin.cpython-311.pyc new file mode 100644 index 0000000..287d271 Binary files /dev/null and b/apps/settingsapp/__pycache__/admin.cpython-311.pyc differ diff --git a/apps/settingsapp/__pycache__/apps.cpython-311.pyc b/apps/settingsapp/__pycache__/apps.cpython-311.pyc new file mode 100644 index 0000000..9cfc1ef Binary files /dev/null and b/apps/settingsapp/__pycache__/apps.cpython-311.pyc differ diff --git a/apps/settingsapp/__pycache__/forms.cpython-311.pyc b/apps/settingsapp/__pycache__/forms.cpython-311.pyc new file mode 100644 index 0000000..b7e5764 Binary files /dev/null and b/apps/settingsapp/__pycache__/forms.cpython-311.pyc differ diff --git a/apps/settingsapp/__pycache__/models.cpython-311.pyc b/apps/settingsapp/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000..68a8908 Binary files /dev/null and b/apps/settingsapp/__pycache__/models.cpython-311.pyc differ diff --git a/apps/settingsapp/__pycache__/urls.cpython-311.pyc b/apps/settingsapp/__pycache__/urls.cpython-311.pyc new file mode 100644 index 0000000..c178d3a Binary files /dev/null and b/apps/settingsapp/__pycache__/urls.cpython-311.pyc differ diff --git a/apps/settingsapp/__pycache__/views.cpython-311.pyc b/apps/settingsapp/__pycache__/views.cpython-311.pyc new file mode 100644 index 0000000..cb9a9bf Binary files /dev/null and b/apps/settingsapp/__pycache__/views.cpython-311.pyc differ diff --git a/apps/settingsapp/migrations/__pycache__/0001_initial.cpython-311.pyc b/apps/settingsapp/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..4a79813 Binary files /dev/null and b/apps/settingsapp/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/apps/settingsapp/migrations/__pycache__/__init__.cpython-311.pyc b/apps/settingsapp/migrations/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..d094d70 Binary files /dev/null and b/apps/settingsapp/migrations/__pycache__/__init__.cpython-311.pyc differ diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..5c5c742 Binary files /dev/null and b/db.sqlite3 differ diff --git a/static/css/styles.css b/static/css/styles.css new file mode 100644 index 0000000..af3fb09 --- /dev/null +++ b/static/css/styles.css @@ -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} + \ No newline at end of file diff --git a/static/img/logo.png b/static/img/logo.png new file mode 100644 index 0000000..3a7177c Binary files /dev/null and b/static/img/logo.png differ diff --git a/templates/auth/login.html b/templates/auth/login.html index 3263493..5f18aa8 100644 --- a/templates/auth/login.html +++ b/templates/auth/login.html @@ -1,9 +1,10 @@ {% extends "base.html" %} +{% block title %}Login · Trafoking{% endblock %} {% block content %} -
+ {% csrf_token %} {{ form.as_p }} - +
{% endblock %} diff --git a/templates/base.html b/templates/base.html index 48f92bd..339caa6 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,14 +1,36 @@ +{% load static %} - Trafoking - - + {% block title %}Trafoking{% endblock %} + + + + - -

Trafoking ⚡👑

- {% block content %}{% endblock %} + + + +
+ + + + +
+ + +
+ {% block content %}{% endblock %} +
+ + + diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..8ca5143 --- /dev/null +++ b/templates/home.html @@ -0,0 +1,20 @@ + +{% extends "base.html" %} +{% load static %} +{% block title %}Trafoking{% endblock %} +{% block content %} +
+ + + +
+ + Empezar concurso + + + Administración + +
+ +
+{% endblock %} diff --git a/templates/participants/form.html b/templates/participants/form.html index fe29b37..7a9c368 100644 --- a/templates/participants/form.html +++ b/templates/participants/form.html @@ -1,21 +1,22 @@ {% extends "base.html" %} +{% block title %}Añadir grupo · Trafoking{% endblock %} {% block content %} - -
+

+ Añadir participante +

+ + {% csrf_token %} {{ form.as_p }} - +
- -
+ {% csrf_token %} -
diff --git a/templates/participants/results.html b/templates/participants/results.html index 8f56a07..50d1cca 100644 --- a/templates/participants/results.html +++ b/templates/participants/results.html @@ -1,18 +1,27 @@ {% extends "base.html" %} +{% block title %}Resultados · Trafoking{% endblock %} {% block content %} - + +

Ranking

+ +
- {% for p in participants %} - - - - - - {% empty %} - - {% endfor %} + {% for p in participants %} + + + + + + {% empty %} + + {% endfor %}
#GrupoPuntuación
{{ forloop.counter }}{{ p.group_name }}{{ p.score|floatformat:2 }}
Sin participantes todavía.
{{forloop.counter}}{{p.group_name}}{{p.score|floatformat:2}}
Sin participantes todavía.
+ + + Añadir más grupos + + {% endblock %} diff --git a/templates/settingsapp/form.html b/templates/settingsapp/form.html index 7508849..0c5bf08 100644 --- a/templates/settingsapp/form.html +++ b/templates/settingsapp/form.html @@ -1,10 +1,16 @@ {% extends "base.html" %} +{% block title %}Ajustes · Trafoking{% endblock %} {% block content %} -

Ajustes de calificación

-
+ +

+ Ajustes de calificación +

+ + {% csrf_token %} {{ form.as_p }} - +
+ {% endblock %} diff --git a/trafoking/__pycache__/__init__.cpython-311.pyc b/trafoking/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..1445471 Binary files /dev/null and b/trafoking/__pycache__/__init__.cpython-311.pyc differ diff --git a/trafoking/__pycache__/settings.cpython-311.pyc b/trafoking/__pycache__/settings.cpython-311.pyc new file mode 100644 index 0000000..c52de05 Binary files /dev/null and b/trafoking/__pycache__/settings.cpython-311.pyc differ diff --git a/trafoking/__pycache__/urls.cpython-311.pyc b/trafoking/__pycache__/urls.cpython-311.pyc new file mode 100644 index 0000000..9a0b5c7 Binary files /dev/null and b/trafoking/__pycache__/urls.cpython-311.pyc differ diff --git a/trafoking/__pycache__/wsgi.cpython-311.pyc b/trafoking/__pycache__/wsgi.cpython-311.pyc new file mode 100644 index 0000000..71418a1 Binary files /dev/null and b/trafoking/__pycache__/wsgi.cpython-311.pyc differ diff --git a/trafoking/settings.py b/trafoking/settings.py index bf8d3d5..d358b55 100644 --- a/trafoking/settings.py +++ b/trafoking/settings.py @@ -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 = "/" diff --git a/trafoking/urls.py b/trafoking/urls.py index 4241f38..6a37e56 100644 --- a/trafoking/urls.py +++ b/trafoking/urls.py @@ -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), ]