diff --git a/core/admin.py b/core/admin.py index d23957e..36e8c01 100644 --- a/core/admin.py +++ b/core/admin.py @@ -34,6 +34,7 @@ apps = [ 'membership', 'youth', 'atu', + 'mbkb', 'core' ] diff --git a/core/context_processors.py b/core/context_processors.py index 30648f5..55ce0ea 100644 --- a/core/context_processors.py +++ b/core/context_processors.py @@ -9,6 +9,7 @@ from db.tournaments.models import * from db.membership.models import * from db.youth.models import * from db.atu.models import * +from db.mbkb.models import * def load_config(request): @@ -24,14 +25,15 @@ def load_config(request): 'regulaminy': Regulation.objects.all(), 'rodos': RODO.objects.all(), 'leagues': { - 'Wyniki I Ligi': FirstLeague.objects.all(), - 'Wyniki II Ligi': SecondLeague.objects.all(), + 'Wyniki I Ligi': FirstLeague.objects.all().reverse(), + 'Wyniki II Ligi': SecondLeague.objects.all().reverse(), 'Wyniki III Ligi': ThirdLeague.objects.all() }, 'calendars': Calendar.objects.all(), 'gpb': GrandPrixB.load(), 'tournaments': Tournament.objects.filter(published=True), 'memberships': Membership.objects.filter(published=True), - 'youth': Youth.load(), + 'youth': Youth.objects.all(), + 'mbkb': MBKB.objects.all(), 'atu': Atu.load() } diff --git a/core/templates/mbkb.html b/core/templates/mbkb.html new file mode 100644 index 0000000..155dfa0 --- /dev/null +++ b/core/templates/mbkb.html @@ -0,0 +1,21 @@ +{% extends 'base.html' %} + +{% block title %}Miejski Białostocki Klub Brydżowy | pdlzbs{% endblock %} + +{% load static tailwind_tags tablepipe %} {% block content %} +

Miejski Białostocki Klub Brydżowy

+ +
+ {% for article in mbkb %} +
+ {% if article.show_title %} +

{{ article.title }}

+ {% endif %} {{ article.content | tablescroll | safe }} +
+ {% if not forloop.last %} +
+ {% endif %} {% empty %} + Brak artykułów + {% endfor %} +
+{% endblock %} diff --git a/core/templates/youth.html b/core/templates/youth.html index af007c7..c6f4eee 100644 --- a/core/templates/youth.html +++ b/core/templates/youth.html @@ -3,5 +3,19 @@ {% block title %}Młodzież | pdlzbs{% endblock %} {% load static tailwind_tags tablepipe %} {% block content %} -
{{ youth.content | safe }}
+

Młodzież

+ +
+ {% for article in youth %} +
+ {% if article.show_title %} +

{{ article.title }}

+ {% endif %} {{ article.content | tablescroll | safe }} +
+ {% if not forloop.last %} +
+ {% endif %} {% empty %} + Brak artykułów + {% endfor %} +
{% endblock %} diff --git a/core/urls.py b/core/urls.py index 5e2d613..ec03a91 100644 --- a/core/urls.py +++ b/core/urls.py @@ -19,4 +19,5 @@ urlpatterns = [ path('skladki', MembershipView.as_view(), name='membership'), path('mlodziez', YouthView.as_view(), name='youth'), path('atu', AtuView.as_view(), name='atu'), + path('mbkb', MBKBView.as_view(), name='mbkb'), ] diff --git a/core/views.py b/core/views.py index 1490613..abd1c54 100644 --- a/core/views.py +++ b/core/views.py @@ -59,3 +59,7 @@ class YouthView(TemplateView): class AtuView(TemplateView): template_name = 'atu.html' + + +class MBKBView(TemplateView): + template_name = "mbkb.html" diff --git a/db/league/migrations/0004_alter_firstleague_options_alter_secondleague_options_and_more.py b/db/league/migrations/0004_alter_firstleague_options_alter_secondleague_options_and_more.py new file mode 100644 index 0000000..8de42eb --- /dev/null +++ b/db/league/migrations/0004_alter_firstleague_options_alter_secondleague_options_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 4.0.5 on 2022-08-15 02:08 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('league', '0003_firstleague_secondleague_rename_league_thirdleague_and_more'), + ] + + operations = [ + migrations.AlterModelOptions( + name='firstleague', + options={'ordering': ['-year'], 'verbose_name': 'Wyniki I ligi', 'verbose_name_plural': 'Wyniki I ligi'}, + ), + migrations.AlterModelOptions( + name='secondleague', + options={'ordering': ['-year'], 'verbose_name': 'Wyniki II ligi', 'verbose_name_plural': 'Wyniki II ligi'}, + ), + migrations.AlterModelOptions( + name='thirdleague', + options={'ordering': ['-year'], 'verbose_name': 'Wyniki III ligi', 'verbose_name_plural': 'Wyniki III ligi'}, + ), + ] diff --git a/db/league/models.py b/db/league/models.py index 5a9883e..0010a23 100644 --- a/db/league/models.py +++ b/db/league/models.py @@ -13,7 +13,6 @@ class League(models.Model): class Meta: abstract = True - ordering = ['-year'] class FirstLeague(League): @@ -22,6 +21,7 @@ class FirstLeague(League): class Meta: verbose_name = 'Wyniki I ligi' verbose_name_plural = 'Wyniki I ligi' + ordering = ['-year'] class SecondLeague(League): @@ -30,6 +30,7 @@ class SecondLeague(League): class Meta: verbose_name = 'Wyniki II ligi' verbose_name_plural = 'Wyniki II ligi' + ordering = ['-year'] class ThirdLeague(League): @@ -38,3 +39,4 @@ class ThirdLeague(League): class Meta: verbose_name = 'Wyniki III ligi' verbose_name_plural = 'Wyniki III ligi' + ordering = ['-year'] diff --git a/db/mbkb/__init__.py b/db/mbkb/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/db/mbkb/admin.py b/db/mbkb/admin.py new file mode 100644 index 0000000..fac2c3b --- /dev/null +++ b/db/mbkb/admin.py @@ -0,0 +1,13 @@ +from django.contrib import admin +from admin_ordering.admin import OrderableAdmin +from .models import * + +# Register your models here. + + +@admin.register(MBKB) +class MBKBModelAdmin(OrderableAdmin, admin.ModelAdmin): + list_display = ['__str__', 'ordering'] + list_editable = ['ordering'] + ordering_field_hide_input = True + exclude = ['ordering'] diff --git a/db/mbkb/apps.py b/db/mbkb/apps.py new file mode 100644 index 0000000..bcaab3c --- /dev/null +++ b/db/mbkb/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class MbkbConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'db.mbkb' + verbose_name = 'Miejski Białostocki Klub Brydżowy' diff --git a/db/mbkb/migrations/0001_initial.py b/db/mbkb/migrations/0001_initial.py new file mode 100644 index 0000000..7795b22 --- /dev/null +++ b/db/mbkb/migrations/0001_initial.py @@ -0,0 +1,32 @@ +# Generated by Django 4.0.5 on 2022-08-15 01:54 + +from django.db import migrations, models +import tinymce.models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='MBKB', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ordering', models.IntegerField(default=0, verbose_name='Kolejność')), + ('published', models.BooleanField(default=True, verbose_name='Wpis opublikowany')), + ('show_title', models.BooleanField(default=True, verbose_name='Pokaż tytuł')), + ('title', models.CharField(blank=True, default='', max_length=250, verbose_name='Tytuł')), + ('content', tinymce.models.HTMLField(blank=True, default='', verbose_name='Tekst')), + ], + options={ + 'verbose_name': 'Artykuł MBKB', + 'verbose_name_plural': 'Artykuły MBKB', + 'ordering': ['ordering'], + 'abstract': False, + }, + ), + ] diff --git a/db/mbkb/migrations/__init__.py b/db/mbkb/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/db/mbkb/models.py b/db/mbkb/models.py new file mode 100644 index 0000000..46d7a4d --- /dev/null +++ b/db/mbkb/models.py @@ -0,0 +1,19 @@ +from django.db import models +from tinymce.models import HTMLField +from admin_ordering.models import OrderableModel + +# Create your models here. + + +class MBKB(OrderableModel): + published = models.BooleanField('Wpis opublikowany', default=True) + show_title = models.BooleanField('Pokaż tytuł', default=True) + title = models.CharField('Tytuł', default='', blank=True, max_length=250) + content = HTMLField('Tekst', default='', blank=True) + + def __str__(self): + return self.title or '(brak tytułu)' + + class Meta(OrderableModel.Meta): + verbose_name = 'Artykuł MBKB' + verbose_name_plural = 'Artykuły MBKB' diff --git a/db/youth/admin.py b/db/youth/admin.py new file mode 100644 index 0000000..41db4b3 --- /dev/null +++ b/db/youth/admin.py @@ -0,0 +1,13 @@ +from django.contrib import admin +from admin_ordering.admin import OrderableAdmin +from .models import * + +# Register your models here. + + +@admin.register(Youth) +class YouthModelAdmin(OrderableAdmin, admin.ModelAdmin): + list_display = ['__str__', 'ordering'] + list_editable = ['ordering'] + ordering_field_hide_input = True + exclude = ['ordering'] diff --git a/db/youth/migrations/0002_alter_youth_options_youth_ordering_youth_published_and_more.py b/db/youth/migrations/0002_alter_youth_options_youth_ordering_youth_published_and_more.py new file mode 100644 index 0000000..d48bab6 --- /dev/null +++ b/db/youth/migrations/0002_alter_youth_options_youth_ordering_youth_published_and_more.py @@ -0,0 +1,37 @@ +# Generated by Django 4.0.5 on 2022-08-15 01:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('youth', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='youth', + options={'ordering': ['ordering'], 'verbose_name': 'Młodzież', 'verbose_name_plural': 'Młodzież'}, + ), + migrations.AddField( + model_name='youth', + name='ordering', + field=models.IntegerField(default=0, verbose_name='Kolejność'), + ), + migrations.AddField( + model_name='youth', + name='published', + field=models.BooleanField(default=True, verbose_name='Wpis opublikowany'), + ), + migrations.AddField( + model_name='youth', + name='show_title', + field=models.BooleanField(default=True, verbose_name='Pokaż tytuł'), + ), + migrations.AddField( + model_name='youth', + name='title', + field=models.CharField(blank=True, default='', max_length=250, verbose_name='Tytuł'), + ), + ] diff --git a/db/youth/models.py b/db/youth/models.py index bf7b5bf..3763300 100644 --- a/db/youth/models.py +++ b/db/youth/models.py @@ -1,16 +1,19 @@ from django.db import models from tinymce.models import HTMLField -from core.utils import SingletonModel +from admin_ordering.models import OrderableModel # Create your models here. -class Youth(SingletonModel): +class Youth(OrderableModel): + published = models.BooleanField('Wpis opublikowany', default=True) + show_title = models.BooleanField('Pokaż tytuł', default=True) + title = models.CharField('Tytuł', default='', blank=True, max_length=250) content = HTMLField('Tekst', default='', blank=True) def __str__(self): - return 'Młodzież' + return self.title or '(brak tytułu)' - class Meta: + class Meta(OrderableModel.Meta): verbose_name = 'Młodzież' verbose_name_plural = 'Młodzież' diff --git a/pdlzbs/settings.py b/pdlzbs/settings.py index 24b8195..dc7e9e0 100644 --- a/pdlzbs/settings.py +++ b/pdlzbs/settings.py @@ -52,6 +52,7 @@ INSTALLED_APPS = [ 'db.membership', 'db.youth', 'db.atu', + 'db.mbkb', 'theme', 'core' ] + [ diff --git a/theme/static/css/dist/styles.css b/theme/static/css/dist/styles.css index 2984374..c20db76 100644 --- a/theme/static/css/dist/styles.css +++ b/theme/static/css/dist/styles.css @@ -1300,10 +1300,6 @@ select { margin-bottom: 1rem; } -.mt-8 { - margin-top: 2rem; -} - .mb-auto { margin-bottom: auto; } @@ -1336,14 +1332,6 @@ select { display: none; } -.h-\[40px\] { - height: 40px; -} - -.h-full { - height: 100%; -} - .h-screen { height: 100vh; } @@ -1364,10 +1352,6 @@ select { width: 100%; } -.w-\[48px\] { - width: 48px; -} - .w-36 { width: 9rem; } @@ -1388,10 +1372,6 @@ select { max-width: 768px; } -.shrink-0 { - flex-shrink: 0; -} - .basis-1\/2 { flex-basis: 50%; } @@ -1593,10 +1573,6 @@ select { font-size: 15px; } -.text-\[13px\] { - font-size: 13px; -} - .text-\[2\.25rem\] { font-size: 2.25rem; } @@ -1614,14 +1590,14 @@ select { font-weight: 300; } -.font-bold { - font-weight: 700; -} - .font-semibold { font-weight: 600; } +.font-normal { + font-weight: 400; +} + .lowercase { text-transform: lowercase; } @@ -1642,11 +1618,6 @@ select { letter-spacing: 0em; } -.text-white { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); -} - .antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;