mirror of
https://github.com/adrigongv23/G26---Telemetry-Software.git
synced 2026-08-25 19:43:16 +02:00
Admins.py configurados correctamente dados los cambios realizado en la base de datos
This commit is contained in:
parent
99426f7335
commit
e64a08326c
26 changed files with 416 additions and 34 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -2,17 +2,26 @@ from django.contrib import admin
|
|||
from django.contrib.auth.admin import UserAdmin
|
||||
from .models import CustomUser
|
||||
|
||||
@admin.register(CustomUser)
|
||||
class CustomUserAdmin(UserAdmin):
|
||||
model = CustomUser
|
||||
list_display = ('username', 'first_name', 'last_name', 'rol', 'especialidad', 'is_staff')
|
||||
|
||||
# Esto añade una sección nueva al editar un usuario existente
|
||||
# Filtramos por rol y área técnica
|
||||
list_filter = ('rol', 'especialidad', 'is_staff', 'is_active')
|
||||
|
||||
# Buscador de usuarios
|
||||
search_fields = ('username', 'first_name', 'last_name', 'email')
|
||||
|
||||
# Para editar al usuario con los datos insertados
|
||||
fieldsets = UserAdmin.fieldsets + (
|
||||
('Información del Equipo (TFG)', {'fields': ('rol', 'especialidad')}),
|
||||
('Información del Equipo Gades', {
|
||||
'fields': ('rol', 'especialidad'),
|
||||
}),
|
||||
)
|
||||
|
||||
# Esto permite añadir estos campos cuando creas un usuario nuevo desde el admin
|
||||
# Para crear al usuario con los datos insertados
|
||||
add_fieldsets = UserAdmin.add_fieldsets + (
|
||||
('Información del Equipo (TFG)', {'fields': ('rol', 'especialidad')}),
|
||||
)
|
||||
|
||||
admin.site.register(CustomUser, CustomUserAdmin)
|
||||
('Información del Equipo Gades', {
|
||||
'fields': ('rol', 'especialidad'),
|
||||
}),
|
||||
)
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 6.0.2 on 2026-03-06 19:29
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0002_alter_customuser_especialidad_alter_customuser_rol'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customuser',
|
||||
name='especialidad',
|
||||
field=models.CharField(blank=True, choices=[('aerodinamica', 'Aerodinámica'), ('chasis', 'Chasis'), ('business_operations', 'Business & Operations'), ('epowertrain', 'E-Powertrain'), ('electronica', 'Electrónica'), ('sdf', 'SDF'), ('motor_transmision', 'Motor & Transmisión'), ('software', 'Software')], max_length=30, null=True, verbose_name='Área Técnica'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customuser',
|
||||
name='rol',
|
||||
field=models.CharField(choices=[('directiva', 'Directiva'), ('jefe_area', 'Jefe de Área'), ('miembro', 'Miembro')], default='miembro', max_length=20, verbose_name='Rol en el equipo'),
|
||||
),
|
||||
]
|
||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue