mirror of
https://github.com/adrigongv23/G26---Telemetry-Software.git
synced 2026-08-25 19:43:16 +02:00
App gestion y pruebas añadidas a la base de datos
This commit is contained in:
parent
0e0c8d7d1b
commit
ec44ae2e46
26 changed files with 209 additions and 3 deletions
Binary file not shown.
|
|
@ -11,7 +11,7 @@ class Documento(models.Model):
|
||||||
('suspension', 'Suspensión'),
|
('suspension', 'Suspensión'),
|
||||||
('motor', 'Motor/Powertrain'),
|
('motor', 'Motor/Powertrain'),
|
||||||
('electronica', 'Electrónica'),
|
('electronica', 'Electrónica'),
|
||||||
('general', 'General / Normativa'),
|
('normativa', 'General / Normativa'),
|
||||||
('software', 'Software')
|
('software', 'Software')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -35,6 +35,8 @@ INSTALLED_APPS = [
|
||||||
'users',
|
'users',
|
||||||
'temporadas',
|
'temporadas',
|
||||||
'documentos',
|
'documentos',
|
||||||
|
'gestion',
|
||||||
|
'pruebas',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
|
|
||||||
BIN
Plataform_Web/gestion/__pycache__/admin.cpython-314.pyc
Normal file
BIN
Plataform_Web/gestion/__pycache__/admin.cpython-314.pyc
Normal file
Binary file not shown.
BIN
Plataform_Web/gestion/__pycache__/apps.cpython-314.pyc
Normal file
BIN
Plataform_Web/gestion/__pycache__/apps.cpython-314.pyc
Normal file
Binary file not shown.
BIN
Plataform_Web/gestion/__pycache__/models.cpython-314.pyc
Normal file
BIN
Plataform_Web/gestion/__pycache__/models.cpython-314.pyc
Normal file
Binary file not shown.
|
|
@ -1,3 +1,14 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from .models import Factura, Patrocinador
|
||||||
|
|
||||||
# Register your models here.
|
@admin.register(Factura)
|
||||||
|
class FacturaAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('nombre', 'empresa', 'categoria', 'temporada', 'subido_por')
|
||||||
|
list_filter = ('categoria', 'temporada')
|
||||||
|
search_fields = ('nombre', 'empresa')
|
||||||
|
|
||||||
|
@admin.register(Patrocinador)
|
||||||
|
class PatrocinadorAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('empresa', 'tipo_empresa', 'tipo_patrocinio', 'estado', 'temporada')
|
||||||
|
list_filter = ('estado', 'tipo_empresa', 'tipo_patrocinio', 'temporada')
|
||||||
|
search_fields = ('empresa', 'email_contacto')
|
||||||
45
Plataform_Web/gestion/migrations/0001_initial.py
Normal file
45
Plataform_Web/gestion/migrations/0001_initial.py
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
# Generated by Django 6.0.2 on 2026-02-19 10:14
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('temporadas', '0001_initial'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Factura',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('nombre', models.CharField(max_length=100, verbose_name='Concepto de la factura')),
|
||||||
|
('empresa', models.CharField(max_length=100, verbose_name='Empresa / Proveedor')),
|
||||||
|
('categoria', models.CharField(choices=[('aerodinamica', 'Aerodinámica'), ('chasis', 'Chasis'), ('business', 'Business & Operations'), ('epowertrain', 'E-Powertrain'), ('electronica', 'Electrónica'), ('sdf', 'SDF'), ('motor_transmision', 'Motor & Transmisión'), ('software', 'Software'), ('general', 'General')], max_length=30)),
|
||||||
|
('descripcion', models.TextField(blank=True, null=True, verbose_name='Breve descripción')),
|
||||||
|
('archivo', models.FileField(upload_to='facturas/', verbose_name='Foto o PDF de la factura')),
|
||||||
|
('subido_por', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Usuario que la sube')),
|
||||||
|
('temporada', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='temporadas.temporada')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Patrocinador',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('empresa', models.CharField(max_length=100, verbose_name='Nombre de la Empresa')),
|
||||||
|
('email_contacto', models.EmailField(max_length=254, verbose_name='Correo de contacto')),
|
||||||
|
('tipo_empresa', models.CharField(max_length=30, verbose_name='Tipo de la Empresa')),
|
||||||
|
('tipo_patrocinio', models.CharField(choices=[('economico', 'Económico'), ('piezas/materiales', 'Piezas/Materiales'), ('mixto', 'Mixto (Dinero y Piezas)')], max_length=30)),
|
||||||
|
('detalle_piezas', models.TextField(blank=True, help_text='Detallar qué se ofrece si es en especies', null=True)),
|
||||||
|
('estado', models.CharField(choices=[('en contacto', 'En contacto'), ('aceptado', 'Aceptado / Activo'), ('denegado', 'Denegado')], default='contacto', max_length=20)),
|
||||||
|
('contacto_equipo', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Miembro al cargo')),
|
||||||
|
('temporada', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='temporadas.temporada')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,3 +1,63 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from users.models import CustomUser
|
||||||
|
from temporadas.models import Temporada
|
||||||
|
|
||||||
# Create your models here.
|
class Factura(models.Model):
|
||||||
|
CATEGORIAS = (
|
||||||
|
('aerodinamica', 'Aerodinámica'),
|
||||||
|
('chasis', 'Chasis'),
|
||||||
|
('business', 'Business & Operations'),
|
||||||
|
('epowertrain', 'E-Powertrain'),
|
||||||
|
('electronica', 'Electrónica'),
|
||||||
|
('sdf', 'SDF'),
|
||||||
|
('motor_transmision', 'Motor & Transmisión'),
|
||||||
|
('software', 'Software'),
|
||||||
|
('general', 'General'),
|
||||||
|
)
|
||||||
|
|
||||||
|
nombre = models.CharField(max_length=100, verbose_name="Concepto de la factura")
|
||||||
|
empresa = models.CharField(max_length=100, verbose_name="Empresa / Proveedor")
|
||||||
|
categoria = models.CharField(max_length=30, choices=CATEGORIAS)
|
||||||
|
descripcion = models.TextField(blank=True, null=True, verbose_name="Breve descripción")
|
||||||
|
|
||||||
|
# Puede ser foto (jpg/png) o pdf
|
||||||
|
archivo = models.FileField(upload_to='facturas/', verbose_name="Foto o PDF de la factura")
|
||||||
|
|
||||||
|
# Relaciones
|
||||||
|
subido_por = models.ForeignKey(CustomUser, on_delete=models.SET_NULL, null=True, verbose_name="Usuario que la sube")
|
||||||
|
temporada = models.ForeignKey(Temporada, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.nombre} - {self.empresa}"
|
||||||
|
|
||||||
|
|
||||||
|
class Patrocinador(models.Model):
|
||||||
|
|
||||||
|
TIPO_PATROCINIO = (
|
||||||
|
('economico', 'Económico'),
|
||||||
|
('piezas/materiales', 'Piezas/Materiales'),
|
||||||
|
('mixto', 'Mixto (Dinero y Piezas)'),
|
||||||
|
)
|
||||||
|
|
||||||
|
ESTADOS = (
|
||||||
|
('en contacto', 'En contacto'),
|
||||||
|
('aceptado', 'Aceptado / Activo'),
|
||||||
|
('denegado', 'Denegado'),
|
||||||
|
)
|
||||||
|
|
||||||
|
empresa = models.CharField(max_length=100, verbose_name="Nombre de la Empresa")
|
||||||
|
email_contacto = models.EmailField(verbose_name="Correo de contacto")
|
||||||
|
tipo_empresa = models.CharField(max_length=30, verbose_name="Tipo de la Empresa")
|
||||||
|
tipo_patrocinio = models.CharField(max_length=30, choices=TIPO_PATROCINIO)
|
||||||
|
|
||||||
|
# Solo se rellena si el patrocinio es de piezas
|
||||||
|
detalle_piezas = models.TextField(blank=True, null=True, help_text="Detallar qué se ofrece si es en especies")
|
||||||
|
|
||||||
|
estado = models.CharField(max_length=20, choices=ESTADOS, default='contacto')
|
||||||
|
|
||||||
|
# Relaciones
|
||||||
|
contacto_equipo = models.ForeignKey(CustomUser, on_delete=models.SET_NULL, null=True, verbose_name="Miembro al cargo")
|
||||||
|
temporada = models.ForeignKey(Temporada, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.empresa
|
||||||
0
Plataform_Web/pruebas/__init__.py
Normal file
0
Plataform_Web/pruebas/__init__.py
Normal file
BIN
Plataform_Web/pruebas/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
Plataform_Web/pruebas/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
Plataform_Web/pruebas/__pycache__/admin.cpython-314.pyc
Normal file
BIN
Plataform_Web/pruebas/__pycache__/admin.cpython-314.pyc
Normal file
Binary file not shown.
BIN
Plataform_Web/pruebas/__pycache__/apps.cpython-314.pyc
Normal file
BIN
Plataform_Web/pruebas/__pycache__/apps.cpython-314.pyc
Normal file
Binary file not shown.
BIN
Plataform_Web/pruebas/__pycache__/models.cpython-314.pyc
Normal file
BIN
Plataform_Web/pruebas/__pycache__/models.cpython-314.pyc
Normal file
Binary file not shown.
8
Plataform_Web/pruebas/admin.py
Normal file
8
Plataform_Web/pruebas/admin.py
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from .models import TestGeneral
|
||||||
|
|
||||||
|
@admin.register(TestGeneral)
|
||||||
|
class TestGeneralAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('nombre', 'fecha_inicio', 'fecha_fin', 'categoria', 'temporada')
|
||||||
|
list_filter = ('categoria', 'temporada')
|
||||||
|
search_fields = ('nombre', 'descripcion', 'resultados')
|
||||||
5
Plataform_Web/pruebas/apps.py
Normal file
5
Plataform_Web/pruebas/apps.py
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class PruebasConfig(AppConfig):
|
||||||
|
name = 'pruebas'
|
||||||
34
Plataform_Web/pruebas/migrations/0001_initial.py
Normal file
34
Plataform_Web/pruebas/migrations/0001_initial.py
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Generated by Django 6.0.2 on 2026-02-19 10:14
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('temporadas', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TestGeneral',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('nombre', models.CharField(max_length=150, verbose_name='Nombre del Test')),
|
||||||
|
('descripcion', models.TextField(verbose_name='Objetivo / Descripción del test')),
|
||||||
|
('fecha_inicio', models.DateField()),
|
||||||
|
('fecha_fin', models.DateField()),
|
||||||
|
('categoria', models.CharField(choices=[('aerodinamica', 'Aerodinámica'), ('chasis', 'Chasis'), ('business', 'Business & Operations'), ('epowertrain', 'E-Powertrain'), ('electronica', 'Electrónica'), ('sdf', 'SDF'), ('motor_transmision', 'Motor & Transmisión'), ('general', 'General')], default='general', max_length=30)),
|
||||||
|
('resultados', models.TextField(blank=True, null=True, verbose_name='Conclusiones y Resultados')),
|
||||||
|
('temporada', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='temporadas.temporada')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Test General',
|
||||||
|
'verbose_name_plural': 'Tests Generales',
|
||||||
|
'ordering': ['-fecha_inicio'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
0
Plataform_Web/pruebas/migrations/__init__.py
Normal file
0
Plataform_Web/pruebas/migrations/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
35
Plataform_Web/pruebas/models.py
Normal file
35
Plataform_Web/pruebas/models.py
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
from django.db import models
|
||||||
|
from temporadas.models import Temporada
|
||||||
|
|
||||||
|
class TestGeneral(models.Model):
|
||||||
|
CATEGORIAS_TEST = (
|
||||||
|
('aerodinamica', 'Aerodinámica'),
|
||||||
|
('chasis', 'Chasis'),
|
||||||
|
('business', 'Business & Operations'),
|
||||||
|
('epowertrain', 'E-Powertrain'),
|
||||||
|
('electronica', 'Electrónica'),
|
||||||
|
('sdf', 'SDF'),
|
||||||
|
('motor_transmision', 'Motor & Transmisión'),
|
||||||
|
('general', 'General'),
|
||||||
|
)
|
||||||
|
|
||||||
|
nombre = models.CharField(max_length=150, verbose_name="Nombre del Test")
|
||||||
|
descripcion = models.TextField(verbose_name="Objetivo / Descripción del test")
|
||||||
|
|
||||||
|
fecha_inicio = models.DateField()
|
||||||
|
fecha_fin = models.DateField()
|
||||||
|
|
||||||
|
categoria = models.CharField(max_length=30, choices=CATEGORIAS_TEST, default='general')
|
||||||
|
|
||||||
|
resultados = models.TextField(blank=True, null=True, verbose_name="Conclusiones y Resultados")
|
||||||
|
|
||||||
|
# Relación
|
||||||
|
temporada = models.ForeignKey(Temporada, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = "Test General"
|
||||||
|
verbose_name_plural = "Tests Generales"
|
||||||
|
ordering = ['-fecha_inicio']
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.nombre} ({self.fecha_inicio})"
|
||||||
3
Plataform_Web/pruebas/tests.py
Normal file
3
Plataform_Web/pruebas/tests.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
||||||
3
Plataform_Web/pruebas/views.py
Normal file
3
Plataform_Web/pruebas/views.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue