dynamic buttons

main
yaemiku 2023-05-13 20:14:47 +02:00
parent 121722ee3f
commit de9a718bb0
Signed by: podlaskizbs
GPG Key ID: ADC039636B3E4AAB
6 changed files with 197 additions and 69 deletions

View File

@ -20,43 +20,43 @@ class BandAdmin(TabbedModelAdmin):
tab_homepage = ( tab_homepage = (
(None, { (None, {
'fields': ('homepage', 'homepage_buttons') 'fields': ('homepage_rename', 'homepage', 'homepage_buttons')
}), }),
) )
tab_schedule_and_results = ( tab_schedule_and_results = (
(None, { (None, {
'fields': ('schedule_and_results', 'schedule_and_results_enabled', 'schedule_and_results_buttons') 'fields': ('schedule_and_results_rename', 'schedule_and_results', 'schedule_and_results_enabled', 'schedule_and_results_buttons')
}), }),
) )
tab_registration = ( tab_registration = (
(None, { (None, {
'fields': ('registration', 'registration_enabled', 'registration_buttons') 'fields': ('registration_rename', 'registration', 'registration_enabled', 'registration_buttons')
}), }),
) )
tab_rules = ( tab_rules = (
(None, { (None, {
'fields': ('rules', 'rules_enabled', 'rules_buttons') 'fields': ('rules_rename', 'rules', 'rules_enabled', 'rules_buttons')
}), }),
) )
tab_fee_and_prizes = ( tab_fee_and_prizes = (
(None, { (None, {
'fields': ('fee_and_prizes', 'fee_and_prizes_enabled', 'fee_and_prizes_buttons') 'fields': ('fee_and_prizes_rename', 'fee_and_prizes', 'fee_and_prizes_enabled', 'fee_and_prizes_buttons')
}), }),
) )
tab_accomodation = ( tab_accomodation = (
(None, { (None, {
'fields': ('accomodation', 'accomodation_enabled', 'accomodation_buttons') 'fields': ('accomodation_rename', 'accomodation', 'accomodation_enabled', 'accomodation_buttons')
}), }),
) )
tab_contact = ( tab_contact = (
(None, { (None, {
'fields': ('contact', 'contact_enabled', 'contact_buttons') 'fields': ('contact_rename', 'contact', 'contact_enabled', 'contact_buttons')
}), }),
) )
@ -70,3 +70,20 @@ class BandAdmin(TabbedModelAdmin):
('Noclegi', tab_accomodation), ('Noclegi', tab_accomodation),
('Kontakt', tab_contact), ('Kontakt', tab_contact),
] ]
def get_tabs(self, request, obj=None):
tabs = self.tabs
if obj is not None:
tabs = [
('Ogólne ustawienia', self.tab_general),
(obj.homepage_rename, self.tab_homepage),
(obj.schedule_and_results_rename, self.tab_schedule_and_results),
(obj.registration_rename, self.tab_registration),
(obj.rules_rename, self.tab_rules),
(obj.fee_and_prizes_rename, self.tab_fee_and_prizes),
(obj.accomodation_rename, self.tab_accomodation),
(obj.contact_rename, self.tab_contact),
]
self.tabs = tabs
return super(BandAdmin, self).get_tabs(request, obj)

View File

@ -0,0 +1,83 @@
# Generated by Django 4.1.7 on 2023-05-13 17:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tournamentpages', '0003_tournamentpage_homepage_buttons'),
]
operations = [
migrations.AddField(
model_name='tournamentpage',
name='accomodation_rename',
field=models.CharField(default='Noclegi', max_length=250, verbose_name='Nazwa przycisku'),
),
migrations.AddField(
model_name='tournamentpage',
name='contact_rename',
field=models.CharField(default='Kontakt', max_length=250, verbose_name='Nazwa przycisku'),
),
migrations.AddField(
model_name='tournamentpage',
name='fee_and_prizes_rename',
field=models.CharField(default='Wpisowe i nagrody', max_length=250, verbose_name='Nazwa przycisku'),
),
migrations.AddField(
model_name='tournamentpage',
name='homepage_rename',
field=models.CharField(default='Strona główna', max_length=250, verbose_name='Nazwa przycisku'),
),
migrations.AddField(
model_name='tournamentpage',
name='registration_rename',
field=models.CharField(default='Rejestracja', max_length=250, verbose_name='Nazwa przycisku'),
),
migrations.AddField(
model_name='tournamentpage',
name='rules_rename',
field=models.CharField(default='Regulamin', max_length=250, verbose_name='Nazwa przycisku'),
),
migrations.AddField(
model_name='tournamentpage',
name='schedule_and_results_rename',
field=models.CharField(default='Harmonogram i wyniki', max_length=250, verbose_name='Nazwa przycisku'),
),
migrations.AlterField(
model_name='tournamentpage',
name='accomodation_buttons',
field=models.TextField(blank=True, default='', help_text='Tutaj można wpisać dowolną ilość przycisków w następującym formacie:<br /> <code><br /> tekst1 -> link<br /> teskt2 | link<br /> ...<br /> </code><br /> Symbol <code>-></code> oznacza, że link będzie otwarty w nowej karcie<br /> Symbol <code>|</code> oznacza, że link będzie otwarty w tej samej karcie<br /> Na przykład:<br /> <code><br /> pzbs -> https://pzbs.pl<br /> fotogaleria | https://galeria.podlaskizbs.pl<br /> cezar -> https://www.msc.com.pl/cezar<br /> </code><br /> PZBS i Cezar zostaną otwarte w nowej karcie<br /> <b>UWAGA !!</b><br /> Gdy nie podamy tekstu przyciku, nie pokaże on się, można to wykorzystać w taki sposób:<br /> <code><br /> -> link do wyników<br /> fotogaleria -> link do fotogalerii<br /> </code><br /> Wtedy pokaże się <b>tylko przycisk fotogalerii</b><br /> ', verbose_name='Przyciski'),
),
migrations.AlterField(
model_name='tournamentpage',
name='contact_buttons',
field=models.TextField(blank=True, default='', help_text='Tutaj można wpisać dowolną ilość przycisków w następującym formacie:<br /> <code><br /> tekst1 -> link<br /> teskt2 | link<br /> ...<br /> </code><br /> Symbol <code>-></code> oznacza, że link będzie otwarty w nowej karcie<br /> Symbol <code>|</code> oznacza, że link będzie otwarty w tej samej karcie<br /> Na przykład:<br /> <code><br /> pzbs -> https://pzbs.pl<br /> fotogaleria | https://galeria.podlaskizbs.pl<br /> cezar -> https://www.msc.com.pl/cezar<br /> </code><br /> PZBS i Cezar zostaną otwarte w nowej karcie<br /> <b>UWAGA !!</b><br /> Gdy nie podamy tekstu przyciku, nie pokaże on się, można to wykorzystać w taki sposób:<br /> <code><br /> -> link do wyników<br /> fotogaleria -> link do fotogalerii<br /> </code><br /> Wtedy pokaże się <b>tylko przycisk fotogalerii</b><br /> ', verbose_name='Przyciski'),
),
migrations.AlterField(
model_name='tournamentpage',
name='fee_and_prizes_buttons',
field=models.TextField(blank=True, default='', help_text='Tutaj można wpisać dowolną ilość przycisków w następującym formacie:<br /> <code><br /> tekst1 -> link<br /> teskt2 | link<br /> ...<br /> </code><br /> Symbol <code>-></code> oznacza, że link będzie otwarty w nowej karcie<br /> Symbol <code>|</code> oznacza, że link będzie otwarty w tej samej karcie<br /> Na przykład:<br /> <code><br /> pzbs -> https://pzbs.pl<br /> fotogaleria | https://galeria.podlaskizbs.pl<br /> cezar -> https://www.msc.com.pl/cezar<br /> </code><br /> PZBS i Cezar zostaną otwarte w nowej karcie<br /> <b>UWAGA !!</b><br /> Gdy nie podamy tekstu przyciku, nie pokaże on się, można to wykorzystać w taki sposób:<br /> <code><br /> -> link do wyników<br /> fotogaleria -> link do fotogalerii<br /> </code><br /> Wtedy pokaże się <b>tylko przycisk fotogalerii</b><br /> ', verbose_name='Przyciski'),
),
migrations.AlterField(
model_name='tournamentpage',
name='homepage_buttons',
field=models.TextField(blank=True, default='', help_text='Tutaj można wpisać dowolną ilość przycisków w następującym formacie:<br /> <code><br /> tekst1 -> link<br /> teskt2 | link<br /> ...<br /> </code><br /> Symbol <code>-></code> oznacza, że link będzie otwarty w nowej karcie<br /> Symbol <code>|</code> oznacza, że link będzie otwarty w tej samej karcie<br /> Na przykład:<br /> <code><br /> pzbs -> https://pzbs.pl<br /> fotogaleria | https://galeria.podlaskizbs.pl<br /> cezar -> https://www.msc.com.pl/cezar<br /> </code><br /> PZBS i Cezar zostaną otwarte w nowej karcie<br /> <b>UWAGA !!</b><br /> Gdy nie podamy tekstu przyciku, nie pokaże on się, można to wykorzystać w taki sposób:<br /> <code><br /> -> link do wyników<br /> fotogaleria -> link do fotogalerii<br /> </code><br /> Wtedy pokaże się <b>tylko przycisk fotogalerii</b><br /> ', verbose_name='Przyciski'),
),
migrations.AlterField(
model_name='tournamentpage',
name='registration_buttons',
field=models.TextField(blank=True, default='', help_text='Tutaj można wpisać dowolną ilość przycisków w następującym formacie:<br /> <code><br /> tekst1 -> link<br /> teskt2 | link<br /> ...<br /> </code><br /> Symbol <code>-></code> oznacza, że link będzie otwarty w nowej karcie<br /> Symbol <code>|</code> oznacza, że link będzie otwarty w tej samej karcie<br /> Na przykład:<br /> <code><br /> pzbs -> https://pzbs.pl<br /> fotogaleria | https://galeria.podlaskizbs.pl<br /> cezar -> https://www.msc.com.pl/cezar<br /> </code><br /> PZBS i Cezar zostaną otwarte w nowej karcie<br /> <b>UWAGA !!</b><br /> Gdy nie podamy tekstu przyciku, nie pokaże on się, można to wykorzystać w taki sposób:<br /> <code><br /> -> link do wyników<br /> fotogaleria -> link do fotogalerii<br /> </code><br /> Wtedy pokaże się <b>tylko przycisk fotogalerii</b><br /> ', verbose_name='Przyciski'),
),
migrations.AlterField(
model_name='tournamentpage',
name='rules_buttons',
field=models.TextField(blank=True, default='', help_text='Tutaj można wpisać dowolną ilość przycisków w następującym formacie:<br /> <code><br /> tekst1 -> link<br /> teskt2 | link<br /> ...<br /> </code><br /> Symbol <code>-></code> oznacza, że link będzie otwarty w nowej karcie<br /> Symbol <code>|</code> oznacza, że link będzie otwarty w tej samej karcie<br /> Na przykład:<br /> <code><br /> pzbs -> https://pzbs.pl<br /> fotogaleria | https://galeria.podlaskizbs.pl<br /> cezar -> https://www.msc.com.pl/cezar<br /> </code><br /> PZBS i Cezar zostaną otwarte w nowej karcie<br /> <b>UWAGA !!</b><br /> Gdy nie podamy tekstu przyciku, nie pokaże on się, można to wykorzystać w taki sposób:<br /> <code><br /> -> link do wyników<br /> fotogaleria -> link do fotogalerii<br /> </code><br /> Wtedy pokaże się <b>tylko przycisk fotogalerii</b><br /> ', verbose_name='Przyciski'),
),
migrations.AlterField(
model_name='tournamentpage',
name='schedule_and_results_buttons',
field=models.TextField(blank=True, default='', help_text='Tutaj można wpisać dowolną ilość przycisków w następującym formacie:<br /> <code><br /> tekst1 -> link<br /> teskt2 | link<br /> ...<br /> </code><br /> Symbol <code>-></code> oznacza, że link będzie otwarty w nowej karcie<br /> Symbol <code>|</code> oznacza, że link będzie otwarty w tej samej karcie<br /> Na przykład:<br /> <code><br /> pzbs -> https://pzbs.pl<br /> fotogaleria | https://galeria.podlaskizbs.pl<br /> cezar -> https://www.msc.com.pl/cezar<br /> </code><br /> PZBS i Cezar zostaną otwarte w nowej karcie<br /> <b>UWAGA !!</b><br /> Gdy nie podamy tekstu przyciku, nie pokaże on się, można to wykorzystać w taki sposób:<br /> <code><br /> -> link do wyników<br /> fotogaleria -> link do fotogalerii<br /> </code><br /> Wtedy pokaże się <b>tylko przycisk fotogalerii</b><br /> ', verbose_name='Przyciski'),
),
]

View File

@ -2,35 +2,11 @@ from django.db import models
from django.urls.base import reverse_lazy from django.urls.base import reverse_lazy
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from tinymce.models import HTMLField from tinymce.models import HTMLField
from db.help import buttons_help_text
# Create your models here. # Create your models here.
buttons_help_text = """Tutaj można wpisać dowolną ilość przycisków w następującym formacie:
<code>
tekst1 -> link
tekst2 | link
...
</code>
Symbol <code>-></code> oznacza, że link będzie otwarty w nowej karcie
Symbol <code>|</code> oznacza, że link będzie otwarty w tej samej karcie
Na przykład:
<code>
pzbs -> https://pzbs.pl
fotogaleria | https://galeria.podlaskizbs.pl
cezar -> https://www.msc.com.pl/cezar
</code>
PZBS i Cezar zostaną otwarte w nowej karcie
<b>UWAGA !!</b>
Klikając na zdjęcie zawsze zostaniemy przekierowani na pierwszy podany link
Gdy nie podamy tekstu przyciku, nie pokaże on się, można to wykorzystać w taki sposób:
<code>
-> link do wyników
fotogaleria -> link do fotogalerii
</code>
Wtedy pokaże się <b>tylko przycisk fotogalerii</b>, a zdjęcie przekieruje nas do wyników!
""".replace('\n', '<br />')
class TournamentPage(models.Model): class TournamentPage(models.Model):
name = models.CharField('Nazwa', max_length=250) name = models.CharField('Nazwa', max_length=250)
@ -39,10 +15,12 @@ class TournamentPage(models.Model):
header = HTMLField('Nagłówek', default='', blank=True) header = HTMLField('Nagłówek', default='', blank=True)
footer = HTMLField('Stopka', default='', blank=True) footer = HTMLField('Stopka', default='', blank=True)
homepage_rename = models.CharField('Nazwa przycisku', default='Strona główna', max_length=250)
homepage = HTMLField('Strona główna', default='', blank=True) homepage = HTMLField('Strona główna', default='', blank=True)
homepage_buttons = models.TextField( homepage_buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text) 'Przyciski', default='', blank=True, help_text=buttons_help_text)
schedule_and_results_rename = models.CharField('Nazwa przycisku', default='Harmonogram i wyniki', max_length=250)
schedule_and_results = HTMLField( schedule_and_results = HTMLField(
'Harmonogram i wyniki', default='', blank=True) 'Harmonogram i wyniki', default='', blank=True)
schedule_and_results_enabled = models.BooleanField( schedule_and_results_enabled = models.BooleanField(
@ -50,29 +28,34 @@ class TournamentPage(models.Model):
schedule_and_results_buttons = models.TextField( schedule_and_results_buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text) 'Przyciski', default='', blank=True, help_text=buttons_help_text)
registration_rename = models.CharField('Nazwa przycisku', default='Rejestracja', max_length=250)
registration = HTMLField('Rejestracja', default='', blank=True) registration = HTMLField('Rejestracja', default='', blank=True)
registration_enabled = models.BooleanField( registration_enabled = models.BooleanField(
'Strona włączona', default=False) 'Strona włączona', default=False)
registration_buttons = models.TextField( registration_buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text) 'Przyciski', default='', blank=True, help_text=buttons_help_text)
rules_rename = models.CharField('Nazwa przycisku', default='Regulamin', max_length=250)
rules = HTMLField('Regulamin', default='', blank=True) rules = HTMLField('Regulamin', default='', blank=True)
rules_enabled = models.BooleanField('Strona włączona', default=False) rules_enabled = models.BooleanField('Strona włączona', default=False)
rules_buttons = models.TextField( rules_buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text) 'Przyciski', default='', blank=True, help_text=buttons_help_text)
fee_and_prizes_rename = models.CharField('Nazwa przycisku', default='Wpisowe i nagrody', max_length=250)
fee_and_prizes = HTMLField('Wpisowe i nagrody', default='', blank=True) fee_and_prizes = HTMLField('Wpisowe i nagrody', default='', blank=True)
fee_and_prizes_enabled = models.BooleanField( fee_and_prizes_enabled = models.BooleanField(
'Strona włączona', default=False) 'Strona włączona', default=False)
fee_and_prizes_buttons = models.TextField( fee_and_prizes_buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text) 'Przyciski', default='', blank=True, help_text=buttons_help_text)
accomodation_rename = models.CharField('Nazwa przycisku', default='Noclegi', max_length=250)
accomodation = HTMLField('Noclegi', default='', blank=True) accomodation = HTMLField('Noclegi', default='', blank=True)
accomodation_enabled = models.BooleanField( accomodation_enabled = models.BooleanField(
'Strona włączona', default=False) 'Strona włączona', default=False)
accomodation_buttons = models.TextField( accomodation_buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text) 'Przyciski', default='', blank=True, help_text=buttons_help_text)
contact_rename = models.CharField('Nazwa przycisku', default='Kontakt', max_length=250)
contact = HTMLField('Kontakt', default='', blank=True) contact = HTMLField('Kontakt', default='', blank=True)
contact_enabled = models.BooleanField('Strona włączona', default=False) contact_enabled = models.BooleanField('Strona włączona', default=False)
contact_buttons = models.TextField( contact_buttons = models.TextField(

View File

@ -34,36 +34,18 @@
<header>{{ t.header | safe}}</header> <header>{{ t.header | safe}}</header>
<nav class="p-2 bg-green-100 not-prose tpage-nav"> <nav class="p-2 bg-green-100 not-prose tpage-nav">
<ul class="flex flex-row flex-wrap gap-4 text-xl xl:max-w-screen-xl"> <ul class="flex flex-row flex-wrap gap-4 text-xl xl:max-w-screen-xl">
<li class="{% if homepage %}active{% endif %}"> <li class="{% if page == 'homepage' %}active{% endif %}">
<a href="{% url 'homepage' t.id %}">Strona główna</a> <a href="{% url 'homepage' t.id %}">Strona główna</a>
</li> </li>
{% if t.schedule_and_results_enabled %} {% for key, val in rename.items %}
<li class="{% if schedule_and_results %}active{% endif %}"> {% if val != '' %}
<a href="{% url 'schedule_and_results' t.id %}" <li class="{% if page == key %}active{% endif %}">
>Harmonogram i wyniki</a <a href="{% url 'page' t.id val.1 %}"
> >{{ val.0 }}</a
</li> >
{% endif %} {% if t.registration_enabled %} </li>
<li class="{% if registration %}active{% endif %}"> {% endif %}
<a href="{% url 'registration' t.id %}">Rejestracja</a> {% endfor %}
</li>
{% endif %} {% if t.rules_enabled %}
<li class="{% if rules %}active{% endif %}">
<a href="{% url 'rules' t.id %}">Regulamin</a>
</li>
{% endif %} {% if t.fee_and_prizes_enabled %}
<li class="{% if fee_and_prizes %}active{% endif %}">
<a href="{% url 'fee_and_prizes' t.id %}">Wpisowe i nagrody</a>
</li>
{% endif %} {% if t.accomodation_enabled %}
<li class="{% if accomodation %}active{% endif %}">
<a href="{% url 'accomodation' t.id %}">Noclegi</a>
</li>
{% endif %} {% if t.contact_enabled %}
<li class="{% if contact %}active{% endif %}">
<a href="{% url 'contact' t.id %}">Kontakt</a>
</li>
{% endif %}
</ul> </ul>
</nav> </nav>
<main class="flex flex-col"> <main class="flex flex-col">

View File

@ -4,11 +4,5 @@ from .views import *
urlpatterns = [ urlpatterns = [
path('<int:id>', HomeView.as_view(), name='homepage'), path('<int:id>', HomeView.as_view(), name='homepage'),
path('<int:id>/wyniki', ScheduleAndResultsView.as_view(), path('<int:id>/<str:page>', PageView.as_view(), name='page'),
name='schedule_and_results'),
path('<int:id>/rejestracja', RegistrationView.as_view(), name='registration'),
path('<int:id>/regulamin', RulesView.as_view(), name='rules'),
path('<int:id>/nagrody', FeeAndPrizesView.as_view(), name='fee_and_prizes'),
path('<int:id>/noclegi', AccomodationView.as_view(), name='accomodation'),
path('<int:id>/kontakt', ContactView.as_view(), name='contact'),
] ]

View File

@ -1,16 +1,85 @@
from django.shortcuts import render from django.shortcuts import render
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.utils.text import slugify
from .models import TournamentPage from .models import TournamentPage
# Create your views here. # Create your views here.
def func(id, page):
t = TournamentPage.objects.get(
id=id, published=True)
remap = {
'wyniki': 'schedule_and_results',
'rejestracja': 'registration',
'regulamin': 'rules',
'nagrody': 'fee_and_prizes',
'noclegi': 'accomodation',
'kontakt': 'contact',
f'{slugify(t.schedule_and_results_rename)}': 'schedule_and_results',
f'{slugify(t.registration_rename)}': 'registration',
f'{slugify(t.rules_rename)}': 'rules',
f'{slugify(t.fee_and_prizes_rename)}': 'fee_and_prizes',
f'{slugify(t.accomodation_rename)}': 'accomodation',
f'{slugify(t.contact_rename)}': 'contact'
}
rename = {
'schedule_and_results': (t.schedule_and_results_rename, slugify(t.schedule_and_results_rename)) if t.schedule_and_results_enabled else '',
'registration': (t.registration_rename, slugify(t.registration_rename)) if t.registration_enabled else '',
'rules': (t.rules_rename, slugify(t.rules_rename)) if t.rules_enabled else '',
'fee_and_prizes': (t.fee_and_prizes_rename, slugify(t.fee_and_prizes_rename)) if t.fee_and_prizes_enabled else '',
'accomodation': (t.accomodation_rename, slugify(t.accomodation_rename)) if t.accomodation_enabled else '',
'contact': (t.contact_rename, slugify(t.contact_rename)) if t.contact_enabled else '',
}
page = remap[page] if page in remap else page
return {'t': t, 'rename': rename, 'content': t.__dict__[page], 'content_buttons': t.__dict__[f'{page}_buttons'], 'page': page}
class HomeView(TemplateView): class HomeView(TemplateView):
template_name = "tournament.html" template_name = "tournament.html"
def get_context_data(self, id, **kwargs): def get_context_data(self, id, **kwargs):
t = TournamentPage.objects.get(id=id, published=True) return func(id, 'homepage')
return {'t': t, 'content': t.homepage, 'content_buttons': t.homepage_buttons, 'homepage': True}
class PageView(TemplateView):
template_name = "tournament.html"
def get_context_data(self, id, page, **kwargs):
t = TournamentPage.objects.get(
id=id, published=True)
remap = {
'wyniki': 'schedule_and_results',
'rejestracja': 'registration',
'regulamin': 'rules',
'nagrody': 'fee_and_prizes',
'noclegi': 'accomodation',
'kontakt': 'contact',
f'{slugify(t.schedule_and_results_rename)}': 'schedule_and_results',
f'{slugify(t.registration_rename)}': 'registration',
f'{slugify(t.rules_rename)}': 'rules',
f'{slugify(t.fee_and_prizes_rename)}': 'fee_and_prizes',
f'{slugify(t.accomodation_rename)}': 'accomodation',
f'{slugify(t.contact_rename)}': 'contact'
}
rename = {
'schedule_and_results': (t.schedule_and_results_rename, slugify(t.schedule_and_results_rename)) if t.schedule_and_results_enabled else '',
'registration': (t.registration_rename, slugify(t.registration_rename)) if t.registration_enabled else '',
'rules': (t.rules_rename, slugify(t.rules_rename)) if t.rules_enabled else '',
'fee_and_prizes': (t.fee_and_prizes_rename, slugify(t.fee_and_prizes_rename)) if t.fee_and_prizes_enabled else '',
'accomodation': (t.accomodation_rename, slugify(t.accomodation_rename)) if t.accomodation_enabled else '',
'contact': (t.contact_rename, slugify(t.contact_rename)) if t.contact_enabled else '',
}
page = remap[page] if page in remap else page
return {'t': t, 'rename': rename, 'content': t.__dict__[page], 'content_buttons': t.__dict__[f'{page}_buttons'], 'page': page}
class ScheduleAndResultsView(TemplateView): class ScheduleAndResultsView(TemplateView):