From 2f9bb8d43bdda57974b7bc7ed4922fe5ecade874 Mon Sep 17 00:00:00 2001 From: yaemiku Date: Fri, 19 Aug 2022 23:59:23 +0200 Subject: [PATCH] [func] publishing --- core/context_processors.py | 6 +++--- .../migrations/0003_calendar_published.py | 18 ++++++++++++++++++ db/calendar/models.py | 1 + .../0007_alter_tournament_buttons.py | 18 ++++++++++++++++++ .../migrations/0004_alter_youth_buttons.py | 18 ++++++++++++++++++ 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 db/calendar/migrations/0003_calendar_published.py create mode 100644 db/tournaments/migrations/0007_alter_tournament_buttons.py create mode 100644 db/youth/migrations/0004_alter_youth_buttons.py diff --git a/core/context_processors.py b/core/context_processors.py index 6c1a081..2ed1296 100644 --- a/core/context_processors.py +++ b/core/context_processors.py @@ -29,11 +29,11 @@ def load_config(request): 'Wyniki II Ligi': SecondLeague.objects.all(), 'Wyniki III Ligi': ThirdLeague.objects.all() }, - 'calendars': Calendar.objects.all(), + 'calendars': Calendar.objects.filter(published=True), 'gpb': GrandPrixB.load(), 'tournaments': Tournament.objects.filter(published=True), 'memberships': Membership.objects.filter(published=True), - 'youth': Youth.objects.all(), - 'mbkb': MBKB.objects.all(), + 'youth': Youth.objects.filter(published=True), + 'mbkb': MBKB.objects.filter(published=True), 'atu': Atu.load() } diff --git a/db/calendar/migrations/0003_calendar_published.py b/db/calendar/migrations/0003_calendar_published.py new file mode 100644 index 0000000..bb7fec1 --- /dev/null +++ b/db/calendar/migrations/0003_calendar_published.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.5 on 2022-08-19 21:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('calendar', '0002_alter_calendar_content'), + ] + + operations = [ + migrations.AddField( + model_name='calendar', + name='published', + field=models.BooleanField(default=True, verbose_name='Kalendarz opublikowany'), + ), + ] diff --git a/db/calendar/models.py b/db/calendar/models.py index f6fd26e..1fc8639 100644 --- a/db/calendar/models.py +++ b/db/calendar/models.py @@ -5,6 +5,7 @@ from tinymce.models import HTMLField class Calendar(models.Model): + published = models.BooleanField('Kalendarz opublikowany', default=True) year = models.IntegerField('Rok', primary_key=True) content = HTMLField('Kalendarz', default='', blank=True) diff --git a/db/tournaments/migrations/0007_alter_tournament_buttons.py b/db/tournaments/migrations/0007_alter_tournament_buttons.py new file mode 100644 index 0000000..e09709a --- /dev/null +++ b/db/tournaments/migrations/0007_alter_tournament_buttons.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.5 on 2022-08-19 21:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tournaments', '0006_remove_tournament_link_remove_tournament_link_title_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='tournament', + name='buttons', + field=models.TextField(blank=True, default='', help_text='Tutaj można wpisać dowolną ilość przycisków w następującym formacie:

tekst1 -> link
teskt2 | link
...

Symbol -> oznacza, że link będzie otwarty w nowej karcie
Symbol | oznacza, że link będzie otwarty w tej samej karcie
Na przykład:

pzbs -> https://pzbs.pl
fotogaleria | https://galeria.podlaskizbs.pl
cezar -> https://www.msc.com.pl/cezar

PZBS i Cezar zostaną otwarte w nowej karcie
UWAGA !!
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:

-> link do wyników
fotogaleria -> link do fotogalerii

Wtedy pokaże się tylko przycisk fotogalerii, a zdjęcie przekieruje nas do wyników!
', verbose_name='Przyciski'), + ), + ] diff --git a/db/youth/migrations/0004_alter_youth_buttons.py b/db/youth/migrations/0004_alter_youth_buttons.py new file mode 100644 index 0000000..894b089 --- /dev/null +++ b/db/youth/migrations/0004_alter_youth_buttons.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.5 on 2022-08-19 21:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('youth', '0003_youth_buttons'), + ] + + operations = [ + migrations.AlterField( + model_name='youth', + name='buttons', + field=models.TextField(blank=True, default='', help_text='Tutaj można wpisać dowolną ilość przycisków w następującym formacie:

tekst1 -> link
teskt2 | link
...

Symbol -> oznacza, że link będzie otwarty w nowej karcie
Symbol | oznacza, że link będzie otwarty w tej samej karcie
Na przykład:

pzbs -> https://pzbs.pl
fotogaleria | https://galeria.podlaskizbs.pl
cezar -> https://www.msc.com.pl/cezar

PZBS i Cezar zostaną otwarte w nowej karcie
', verbose_name='Przyciski'), + ), + ]