Divide home/models.py en el paquete home/models/ por secciones
El módulo (~310 líneas, 30 modelos) se convierte en un paquete cuyo __init__.py re-exporta todos los modelos, de modo que `from home.models import X`, el admin y el resto de consumidores siguen funcionando igual. Módulos por sección: pricing (precios/costes de servicios + GuildRenameSettings), store (Category, Item, StripeLog, Pedido), site (contenido/config del sitio), recruit, accounts (activación, token de seguridad, LoginAttempt), voting (VoteSite, VoteLog, HomeApiPoints) e history. Las claves foráneas por clase directa quedan en el mismo módulo; cada submódulo importa solo lo que usa. Se eliminan imports de cabecera muertos (ValidationError, uuid, secrets) y las líneas de import duplicadas del original. Migración-neutral: `makemigrations home --dry-run` -> "No changes detected" (app_label=home y nombres/tablas de modelo intactos). Definición de cada modelo idéntica (extracción por AST). `manage.py check` sin incidencias. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
from django.db import models
|
||||
from django_ckeditor_5.fields import CKEditor5Field
|
||||
|
||||
|
||||
class Noticia(models.Model):
|
||||
titulo = models.CharField(max_length=200)
|
||||
contenido = CKEditor5Field('Contenido', config_name='default')
|
||||
fecha_publicacion = models.DateTimeField(auto_now=True) # Cambiado a DateTimeField
|
||||
fecha_fin_evento = models.DateField(null=True, blank=True)
|
||||
enlace = models.URLField(max_length=200, blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.titulo
|
||||
|
||||
class MaintenanceMode(models.Model):
|
||||
is_active = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return "Maintenance Mode"
|
||||
|
||||
class ClienteCategoria(models.Model):
|
||||
nombre = models.CharField(max_length=100)
|
||||
descripcion = models.CharField(max_length=200, blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.nombre
|
||||
|
||||
class SistemaOperativo(models.Model):
|
||||
categoria = models.ForeignKey(ClienteCategoria, related_name='sistemas_operativos', on_delete=models.CASCADE)
|
||||
nombre = models.CharField(max_length=100)
|
||||
url_descarga = models.URLField()
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.nombre} - {self.categoria.nombre}"
|
||||
|
||||
class ServerSelection(models.Model):
|
||||
server_id = models.IntegerField()
|
||||
name = models.CharField(max_length=100)
|
||||
address = models.CharField(max_length=100)
|
||||
port = models.IntegerField()
|
||||
gamebuild = models.IntegerField()
|
||||
|
||||
def __str__(self):
|
||||
expansion = 'WotLK' if self.gamebuild == 12340 else 'Cataclysm' if self.gamebuild == 15595 else 'Unknown'
|
||||
return f"{self.name} ({expansion})"
|
||||
|
||||
class DownloadClientPage(models.Model):
|
||||
title = models.CharField(max_length=255, default="Descarga del cliente")
|
||||
content = CKEditor5Field('Contenido', config_name='default')
|
||||
mac_instructions = CKEditor5Field('Instrucciones para macOS', blank=True, null=True, config_name='default')
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
class ContentCreator(models.Model):
|
||||
title = models.CharField(max_length=200)
|
||||
description = CKEditor5Field('Descripción', config_name='default')
|
||||
content_type = models.CharField(max_length=60, default="Contenido general")
|
||||
subtitle = models.CharField(max_length=60, default="Nova WoW")
|
||||
youtube_video_url = models.URLField(max_length=300, blank=True, null=True)
|
||||
avatar_image_url = models.URLField(max_length=300, blank=True, null=True)
|
||||
youtube_channel_url = models.URLField(max_length=300, blank=True, null=True)
|
||||
facebook_page_url = models.URLField(max_length=300, blank=True, null=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.titles
|
||||
Reference in New Issue
Block a user