Ignorar la carpeta venv en Git
@@ -3,7 +3,7 @@ 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
|
||||
RecruitAFriend, DownloadClientPage, ContentCreator, RecruitReward, GuildRenameSettings, VoteSite, RenamePrice, CustomizePrice, ChangeRacePrice, ChangeFactionPrice, LevelUpPrice, GoldPrice, TransferPrice, MaintenanceMode
|
||||
)
|
||||
from django.db import connections
|
||||
import logging
|
||||
@@ -17,6 +17,11 @@ logger = logging.getLogger(__name__)
|
||||
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')
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import resolve, reverse
|
||||
from .models import MaintenanceMode
|
||||
|
||||
class MaintenanceMiddleware:
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
# Excluir todas las rutas bajo /admin y la propia página de mantenimiento
|
||||
excluded_prefixes = [
|
||||
reverse('admin:index').rstrip('/'), # Asegura que todas las rutas bajo /admin estén excluidas
|
||||
reverse('maintenance').rstrip('/'), # Página de mantenimiento
|
||||
]
|
||||
|
||||
# Verificar si la ruta actual está en los prefijos excluidos
|
||||
if any(request.path.startswith(prefix) for prefix in excluded_prefixes):
|
||||
return self.get_response(request)
|
||||
|
||||
# Verificar si el modo de mantenimiento está activo
|
||||
try:
|
||||
maintenance = MaintenanceMode.objects.first()
|
||||
if maintenance and maintenance.is_active:
|
||||
return redirect('maintenance')
|
||||
except MaintenanceMode.DoesNotExist:
|
||||
pass
|
||||
|
||||
return self.get_response(request)
|
||||
@@ -0,0 +1,20 @@
|
||||
# Generated by Django 4.2.17 on 2024-12-28 21:22
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0006_changefactionprice_changeraceprice_customizeprice_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='MaintenanceMode',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('is_active', models.BooleanField(default=False)),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -17,6 +17,12 @@ class Noticia(models.Model):
|
||||
def __str__(self):
|
||||
return self.titulo
|
||||
|
||||
class MaintenanceMode(models.Model):
|
||||
is_active = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return "Maintenance Mode"
|
||||
|
||||
class UnstuckHistory(models.Model):
|
||||
character_name = models.CharField(max_length=50)
|
||||
used_at = models.DateTimeField()
|
||||
|
||||
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 12 KiB |
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square70x70logo src="/mstile-70x70.png?v=4"/>
|
||||
<square150x150logo src="/mstile-150x150.png?v=4"/>
|
||||
<square310x310logo src="/mstile-310x310.png?v=4"/>
|
||||
<wide310x150logo src="/mstile-310x150.png?v=4"/>
|
||||
<TileColor>#211917</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
||||
|
Before Width: | Height: | Size: 662 B |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 314 B |
|
Before Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 342 B |
|
Before Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 354 B |
|
Before Width: | Height: | Size: 294 B |
|
Before Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 402 B |
|
Before Width: | Height: | Size: 222 B |
|
Before Width: | Height: | Size: 326 B |
|
Before Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 760 B |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 244 B |
|
Before Width: | Height: | Size: 196 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 786 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |