[func] enable tournament buttons

main
yaemiku 2022-11-05 17:05:06 +01:00
parent fc4b72c853
commit 5bdc4f8b69
Signed by: podlaskizbs
GPG Key ID: ADC039636B3E4AAB
6 changed files with 122 additions and 19 deletions

View File

@ -20,43 +20,43 @@ class BandAdmin(TabbedModelAdmin):
tab_homepage = ( tab_homepage = (
(None, { (None, {
'fields': ('homepage',) 'fields': ('homepage', 'homepage_buttons')
}), }),
) )
tab_schedule_and_results = ( tab_schedule_and_results = (
(None, { (None, {
'fields': ('schedule_and_results', 'schedule_and_results_enabled') 'fields': ('schedule_and_results', 'schedule_and_results_enabled', 'schedule_and_results_buttons')
}), }),
) )
tab_registration = ( tab_registration = (
(None, { (None, {
'fields': ('registration', 'registration_enabled') 'fields': ('registration', 'registration_enabled', 'registration_buttons')
}), }),
) )
tab_rules = ( tab_rules = (
(None, { (None, {
'fields': ('rules', 'rules_enabled') 'fields': ('rules', 'rules_enabled', 'rules_buttons')
}), }),
) )
tab_fee_and_prizes = ( tab_fee_and_prizes = (
(None, { (None, {
'fields': ('fee_and_prizes', 'fee_and_prizes_enabled') 'fields': ('fee_and_prizes', 'fee_and_prizes_enabled', 'fee_and_prizes_buttons')
}), }),
) )
tab_accomodation = ( tab_accomodation = (
(None, { (None, {
'fields': ('accomodation', 'accomodation_enabled') 'fields': ('accomodation', 'accomodation_enabled', 'accomodation_buttons')
}), }),
) )
tab_contact = ( tab_contact = (
(None, { (None, {
'fields': ('contact', 'contact_enabled') 'fields': ('contact', 'contact_enabled', 'contact_buttons')
}), }),
) )

View File

@ -0,0 +1,43 @@
# Generated by Django 4.0.5 on 2022-11-05 15:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tournamentpages', '0001_initial'),
]
operations = [
migrations.AddField(
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 /> tekst2 | 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 /> Klikając na zdjęcie zawsze zostaniemy przekierowani na pierwszy podany link<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>, a zdjęcie przekieruje nas do wyników!<br /> ', verbose_name='Przyciski'),
),
migrations.AddField(
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 /> tekst2 | 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 /> Klikając na zdjęcie zawsze zostaniemy przekierowani na pierwszy podany link<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>, a zdjęcie przekieruje nas do wyników!<br /> ', verbose_name='Przyciski'),
),
migrations.AddField(
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 /> tekst2 | 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 /> Klikając na zdjęcie zawsze zostaniemy przekierowani na pierwszy podany link<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>, a zdjęcie przekieruje nas do wyników!<br /> ', verbose_name='Przyciski'),
),
migrations.AddField(
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 /> tekst2 | 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 /> Klikając na zdjęcie zawsze zostaniemy przekierowani na pierwszy podany link<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>, a zdjęcie przekieruje nas do wyników!<br /> ', verbose_name='Przyciski'),
),
migrations.AddField(
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 /> tekst2 | 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 /> Klikając na zdjęcie zawsze zostaniemy przekierowani na pierwszy podany link<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>, a zdjęcie przekieruje nas do wyników!<br /> ', verbose_name='Przyciski'),
),
migrations.AddField(
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 /> tekst2 | 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 /> Klikając na zdjęcie zawsze zostaniemy przekierowani na pierwszy podany link<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>, a zdjęcie przekieruje nas do wyników!<br /> ', verbose_name='Przyciski'),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.0.5 on 2022-11-05 16:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tournamentpages', '0002_tournamentpage_accomodation_buttons_and_more'),
]
operations = [
migrations.AddField(
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 /> tekst2 | 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 /> Klikając na zdjęcie zawsze zostaniemy przekierowani na pierwszy podany link<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>, a zdjęcie przekieruje nas do wyników!<br /> ', verbose_name='Przyciski'),
),
]

View File

@ -6,6 +6,31 @@ from tinymce.models import HTMLField
# 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)
@ -15,29 +40,43 @@ class TournamentPage(models.Model):
footer = HTMLField('Stopka', default='', blank=True) footer = HTMLField('Stopka', default='', blank=True)
homepage = HTMLField('Strona główna', default='', blank=True) homepage = HTMLField('Strona główna', default='', blank=True)
homepage_buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text)
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(
'Strona włączona', default=False) 'Strona włączona', default=False)
schedule_and_results_buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text)
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(
'Przyciski', default='', blank=True, help_text=buttons_help_text)
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(
'Przyciski', default='', blank=True, help_text=buttons_help_text)
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(
'Przyciski', default='', blank=True, help_text=buttons_help_text)
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(
'Przyciski', default='', blank=True, help_text=buttons_help_text)
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(
'Przyciski', default='', blank=True, help_text=buttons_help_text)
class Meta: class Meta:
verbose_name = 'Strona turnieju' verbose_name = 'Strona turnieju'

View File

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
{% load static tailwind_tags %} {% load static tailwind_tags wysiwyg %}
<html lang="pl" dir="ltr"> <html lang="pl" dir="ltr">
<head> <head>
@ -66,10 +66,13 @@
{% endif %} {% endif %}
</ul> </ul>
</nav> </nav>
<main <main class="flex flex-col">
<div
class="container xl:max-w-screen-xl mx-auto p-4 prose-h1:font-medium prose-img:my-1 prose-p:my-[0.3em]" class="container xl:max-w-screen-xl mx-auto p-4 prose-h1:font-medium prose-img:my-1 prose-p:my-[0.3em]"
> >
{{ content | safe }} {{ content | safe }}
</div>
<div class="mx-auto">{% buttons content_buttons %}</div>
</main> </main>
<footer>{{ t.footer | safe}}</footer> <footer>{{ t.footer | safe}}</footer>
</body> </body>

View File

@ -10,7 +10,7 @@ class HomeView(TemplateView):
def get_context_data(self, id, **kwargs): def get_context_data(self, id, **kwargs):
t = TournamentPage.objects.get(id=id, published=True) t = TournamentPage.objects.get(id=id, published=True)
return {'t': t, 'content': t.homepage, 'homepage': True} return {'t': t, 'content': t.homepage, 'content_buttons': t.homepage_buttons, 'homepage': True}
class ScheduleAndResultsView(TemplateView): class ScheduleAndResultsView(TemplateView):
@ -19,7 +19,7 @@ class ScheduleAndResultsView(TemplateView):
def get_context_data(self, id, **kwargs): def get_context_data(self, id, **kwargs):
t = TournamentPage.objects.get( t = TournamentPage.objects.get(
id=id, published=True, schedule_and_results_enabled=True) id=id, published=True, schedule_and_results_enabled=True)
return {'t': t, 'content': t.schedule_and_results, 'schedule_and_results': True} return {'t': t, 'content': t.schedule_and_results, 'content_buttons': t.schedule_and_results_buttons, 'schedule_and_results': True}
class RegistrationView(TemplateView): class RegistrationView(TemplateView):
@ -28,7 +28,7 @@ class RegistrationView(TemplateView):
def get_context_data(self, id, **kwargs): def get_context_data(self, id, **kwargs):
t = TournamentPage.objects.get( t = TournamentPage.objects.get(
id=id, published=True, registration_enabled=True) id=id, published=True, registration_enabled=True)
return {'t': t, 'content': t.registration, 'registration': True} return {'t': t, 'content': t.registration, 'content_buttons': t.registration_buttons, 'registration': True}
class RulesView(TemplateView): class RulesView(TemplateView):
@ -37,7 +37,7 @@ class RulesView(TemplateView):
def get_context_data(self, id, **kwargs): def get_context_data(self, id, **kwargs):
t = TournamentPage.objects.get( t = TournamentPage.objects.get(
id=id, published=True, rules_enabled=True) id=id, published=True, rules_enabled=True)
return {'t': t, 'content': t.rules, 'rules': True} return {'t': t, 'content': t.rules, 'content_buttons': t.rules_buttons, 'rules': True}
class FeeAndPrizesView(TemplateView): class FeeAndPrizesView(TemplateView):
@ -46,7 +46,7 @@ class FeeAndPrizesView(TemplateView):
def get_context_data(self, id, **kwargs): def get_context_data(self, id, **kwargs):
t = TournamentPage.objects.get( t = TournamentPage.objects.get(
id=id, published=True, fee_and_prizes_enabled=True) id=id, published=True, fee_and_prizes_enabled=True)
return {'t': t, 'content': t.fee_and_prizes, 'fee_and_prizes': True} return {'t': t, 'content': t.fee_and_prizes, 'content_buttons': t.fee_and_prizes_buttons, 'fee_and_prizes': True}
class AccomodationView(TemplateView): class AccomodationView(TemplateView):
@ -55,7 +55,7 @@ class AccomodationView(TemplateView):
def get_context_data(self, id, **kwargs): def get_context_data(self, id, **kwargs):
t = TournamentPage.objects.get( t = TournamentPage.objects.get(
id=id, published=True, accomodation_enabled=True) id=id, published=True, accomodation_enabled=True)
return {'t': t, 'content': t.accomodation, 'accomodation': True} return {'t': t, 'content': t.accomodation, 'content_buttons': t.accomodation_buttons, 'accomodation': True}
class ContactView(TemplateView): class ContactView(TemplateView):
@ -64,4 +64,4 @@ class ContactView(TemplateView):
def get_context_data(self, id, **kwargs): def get_context_data(self, id, **kwargs):
t = TournamentPage.objects.get( t = TournamentPage.objects.get(
id=id, published=True, contact_enabled=True) id=id, published=True, contact_enabled=True)
return {'t': t, 'content': t.contact, 'contact': True} return {'t': t, 'content': t.contact, 'content_buttons': t.contact_buttons, 'contact': True}