Jubilar Django: borrar el portal antiguo, la web ya la sirve Next
El cutover se hizo hoy: Caddy manda www.nightspire.gg a :3001 (Next), así que Django se quedó sin dominio y sin uso. Se comprobó antes de borrar que nada dependía de él: ninguna referencia a :8001 en Caddy, el timer de reconciliación llama a Next, DJANGO_API_BASE no lo leía ni una línea del código (se quita también de la unidad de systemd), web-next/public es autónomo (736 ficheros reales, 0 symlinks) y no hay ni una referencia a /static/. Con Django parado la web siguió dando 200 en todas las rutas. Se va: home/, novawow/, forum/, wotlk_db/, frontend/ (las islas React que Next sustituyó), static/, staticfiles/, manage.py, requirements.txt, db.sqlite3 y el Docker de Django. Se quedan docs/ y sql/: no son código Django sino documentación y esquemas, y sql/forum_schema.sql describe la BD acore_web que Next usa hoy. La BASE DE DATOS no se toca. django_wow y sus 41 tablas home_* son ahora de Next, que las consulta con SQL directo. El nombre se queda por historia. README reescrito: describía cómo montar un Django que ya no existe (venv, manage.py migrate, gunicorn, Docker). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
-204
@@ -1,204 +0,0 @@
|
||||
# home/admin.py
|
||||
from django.contrib import admin
|
||||
from django import forms
|
||||
from .models import (
|
||||
Noticia, ClienteCategoria, SistemaOperativo, ServerSelection,
|
||||
RecruitAFriend, DownloadClientPage, ContentCreator, RecruitReward, GuildRenameSettings, VoteSite, RenamePrice, CustomizePrice, ChangeRacePrice, ChangeFactionPrice, LevelUpPrice, GoldPrice, TransferPrice, MaintenanceMode,
|
||||
StripeLog, Pedido
|
||||
)
|
||||
from django.db import connections
|
||||
import logging
|
||||
from django.shortcuts import redirect
|
||||
from django_ckeditor_5.widgets import CKEditor5Widget
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@admin.register(StripeLog)
|
||||
class StripeLogAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
'account_id', 'username', 'email', 'acore_ip', 'stripe_ip', 'product_name',
|
||||
'amount', 'session_id', 'mode', 'character_name', 'timestamp'
|
||||
) # Añadido stripe_ip
|
||||
list_filter = ('mode', 'timestamp') # Filtros por campo en la parte lateral
|
||||
search_fields = ('username', 'product_name', 'session_id', 'email', 'stripe_ip') # Ahora incluye 'stripe_ip' en la búsqueda
|
||||
ordering = ('-timestamp',) # Ordenar por timestamp descendentes
|
||||
|
||||
@admin.register(Pedido)
|
||||
class PedidoLogAdmin(admin.ModelAdmin): # Ahora esta es una clase de admin
|
||||
list_display = ('transaction_id', 'email_cliente', 'estado', 'monto') # Campos que se mostrarán en el panel
|
||||
search_fields = ('transaction_id', 'email_cliente') # Habilita búsqueda por ID y email
|
||||
list_filter = ('estado',) # Filtro por estado de pago
|
||||
|
||||
|
||||
@admin.register(ChangeFactionPrice)
|
||||
class ChangeFactionPriceAdmin(admin.ModelAdmin):
|
||||
list_display = ('price',)
|
||||
|
||||
|
||||
@admin.register(MaintenanceMode)
|
||||
class MaintenanceModeAdmin(admin.ModelAdmin):
|
||||
list_display = ('is_active',)
|
||||
|
||||
@admin.register(GoldPrice)
|
||||
class GoldPriceAdmin(admin.ModelAdmin):
|
||||
list_display = ('gold_amount', 'price')
|
||||
ordering = ('gold_amount',)
|
||||
|
||||
|
||||
@admin.register(TransferPrice)
|
||||
class TransferPriceAdmin(admin.ModelAdmin):
|
||||
list_display = ('price',)
|
||||
|
||||
@admin.register(LevelUpPrice)
|
||||
class LevelUpPriceAdmin(admin.ModelAdmin):
|
||||
list_display = ('price',)
|
||||
|
||||
# Formulario para el modelo Noticia
|
||||
class NoticiaAdminForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Noticia
|
||||
fields = ['titulo', 'contenido', 'fecha_fin_evento', 'enlace']
|
||||
widgets = {
|
||||
'contenido': CKEditor5Widget(config_name='default'),
|
||||
}
|
||||
|
||||
@admin.register(RenamePrice)
|
||||
class RenamePriceAdmin(admin.ModelAdmin):
|
||||
list_display = ("price",)
|
||||
|
||||
|
||||
@admin.register(CustomizePrice)
|
||||
class CustomizePriceAdmin(admin.ModelAdmin):
|
||||
list_display = ("price",)
|
||||
|
||||
@admin.register(ChangeRacePrice)
|
||||
class ChangeRacePriceAdmin(admin.ModelAdmin):
|
||||
list_display = ('price',)
|
||||
|
||||
@admin.register(Noticia)
|
||||
class NoticiaAdmin(admin.ModelAdmin):
|
||||
form = NoticiaAdminForm
|
||||
list_display = ['titulo', 'fecha_publicacion']
|
||||
readonly_fields = ['fecha_publicacion']
|
||||
fields = ['titulo', 'contenido', 'fecha_fin_evento', 'enlace']
|
||||
|
||||
|
||||
# Formulario para el modelo RecruitAFriend
|
||||
class RecruitAFriendAdminForm(forms.ModelForm):
|
||||
content = forms.CharField(widget=CKEditor5Widget(config_name='default'))
|
||||
|
||||
class Meta:
|
||||
model = RecruitAFriend
|
||||
fields = ['title', 'information', 'content']
|
||||
|
||||
@admin.register(RecruitAFriend)
|
||||
class RecruitAFriendAdmin(admin.ModelAdmin):
|
||||
form = RecruitAFriendAdminForm
|
||||
list_display = ['title', 'updated_at']
|
||||
fields = ['title', 'information', 'content']
|
||||
|
||||
|
||||
# Formulario para el modelo DownloadClientPage
|
||||
class DownloadClientPageAdminForm(forms.ModelForm):
|
||||
content = forms.CharField(widget=CKEditor5Widget(config_name='default'))
|
||||
mac_instructions = forms.CharField(widget=CKEditor5Widget(config_name='default'))
|
||||
|
||||
class Meta:
|
||||
model = DownloadClientPage
|
||||
fields = ['title', 'content', 'mac_instructions']
|
||||
|
||||
@admin.register(DownloadClientPage)
|
||||
class DownloadClientPageAdmin(admin.ModelAdmin):
|
||||
form = DownloadClientPageAdminForm
|
||||
list_display = ['title', 'updated_at']
|
||||
fields = ['title', 'content', 'mac_instructions']
|
||||
|
||||
|
||||
# Formulario para el modelo ContentCreator
|
||||
class ContentCreatorAdminForm(forms.ModelForm):
|
||||
description = forms.CharField(widget=CKEditor5Widget(config_name='default'))
|
||||
|
||||
class Meta:
|
||||
model = ContentCreator
|
||||
fields = [
|
||||
'title', 'description', 'content_type', 'subtitle',
|
||||
'youtube_video_url', 'avatar_image_url',
|
||||
'youtube_channel_url', 'facebook_page_url'
|
||||
]
|
||||
|
||||
@admin.register(ContentCreator)
|
||||
class ContentCreatorAdmin(admin.ModelAdmin):
|
||||
form = ContentCreatorAdminForm
|
||||
list_display = ['title', 'updated_at']
|
||||
fields = [
|
||||
'title', 'description', 'content_type', 'subtitle',
|
||||
'youtube_video_url', 'avatar_image_url',
|
||||
'youtube_channel_url', 'facebook_page_url'
|
||||
]
|
||||
|
||||
|
||||
# Administración para ServerSelection
|
||||
class ServerSelectionAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'address', 'port', 'gamebuild']
|
||||
change_list_template = "admin/server_selection.html"
|
||||
|
||||
def changelist_view(self, request, extra_context=None):
|
||||
servers = []
|
||||
try:
|
||||
with connections['acore_auth'].cursor() as cursor:
|
||||
cursor.execute("SELECT id, name, address, port, gamebuild FROM realmlist")
|
||||
servers = cursor.fetchall()
|
||||
except Exception as e:
|
||||
logger.error("Error al obtener servidores: %s", e)
|
||||
|
||||
if request.method == "POST" and "server_selection" in request.POST:
|
||||
selected_server_id = int(request.POST["server_selection"])
|
||||
selected_server = next((s for s in servers if s[0] == selected_server_id), None)
|
||||
if selected_server:
|
||||
ServerSelection.objects.all().delete()
|
||||
ServerSelection.objects.create(
|
||||
server_id=selected_server[0],
|
||||
name=selected_server[1],
|
||||
address=selected_server[2],
|
||||
port=selected_server[3],
|
||||
gamebuild=selected_server[4]
|
||||
)
|
||||
return redirect("admin:home_serverselection_changelist")
|
||||
|
||||
extra_context = extra_context or {}
|
||||
extra_context['servers'] = servers
|
||||
return super().changelist_view(request, extra_context=extra_context)
|
||||
|
||||
|
||||
# Inlines para ClienteCategoria
|
||||
class SistemaOperativoInline(admin.TabularInline):
|
||||
model = SistemaOperativo
|
||||
extra = 1
|
||||
|
||||
class ClienteCategoriaAdmin(admin.ModelAdmin):
|
||||
inlines = [SistemaOperativoInline]
|
||||
|
||||
|
||||
@admin.register(RecruitReward)
|
||||
class RecruitRewardAdmin(admin.ModelAdmin):
|
||||
list_display = ('required_friends', 'reward_name', 'item_id', 'item_quantity', 'icon_class')
|
||||
search_fields = ('reward_name',)
|
||||
|
||||
@admin.register(GuildRenameSettings)
|
||||
class GuildRenameSettingsAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'cost') # Asegúrate de incluir 'id' antes de 'cost'
|
||||
list_display_links = ('id',) # Permite hacer clic en 'id' para editar
|
||||
list_editable = ('cost',) # Ahora 'cost' es editable en línea
|
||||
|
||||
@admin.register(VoteSite)
|
||||
class VoteSiteAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'points', 'url', 'image_url')
|
||||
search_fields = ('name',)
|
||||
list_editable = ('points',)
|
||||
list_display_links = ('name',)
|
||||
|
||||
|
||||
# Registro de modelos en el admin
|
||||
admin.site.register(ClienteCategoria, ClienteCategoriaAdmin)
|
||||
admin.site.register(SistemaOperativo)
|
||||
admin.site.register(ServerSelection, ServerSelectionAdmin)
|
||||
Reference in New Issue
Block a user