+
{% buttons post.buttons %}
diff --git a/core/templatetags/wysiwyg.py b/core/templatetags/wysiwyg.py
index 90137d9..79d40fb 100644
--- a/core/templatetags/wysiwyg.py
+++ b/core/templatetags/wysiwyg.py
@@ -23,7 +23,7 @@ def readmore(context, value: str):
cntnt = res[0]
if len(res) > 1:
cntnt += '
...
'
- cntnt += f'
Czytaj dalej'
+ cntnt += f'
Czytaj dalej'
cntnt += '
'
return mark_safe(tableoverflow(cntnt))
diff --git a/core/urls.py b/core/urls.py
index b518eb2..6f01c4c 100644
--- a/core/urls.py
+++ b/core/urls.py
@@ -1,12 +1,13 @@
from django.urls import path
from .views import rtpath, tpath
-from db.main.models import Post
+from db.main.models import Post, GrandPrixW
from db.tournaments.models import Tournament
from db.youth.models import Youth
urlpatterns = [
tpath('', 'home', {'home': 'active'}),
+ rtpath('grandprixwojewodztwa/
', 'gpw', GrandPrixW),
rtpath('aktualnosci/', 'home', Post, {'home': 'active'}),
tpath('zarzad', 'administration'),
diff --git a/core/views.py b/core/views.py
index 56e36b7..1c20a50 100644
--- a/core/views.py
+++ b/core/views.py
@@ -13,7 +13,7 @@ def template(filename, ec={}):
def reverse_template(filename, model, ec={}):
def closure(request, id):
- return render(request, filename+'-reverse.html', {**ec, 'focus': model.objects.get(id=id)})
+ return render(request, filename+'-reverse.html', {**ec, 'focus': model.objects.get(pk=id)})
return closure
diff --git a/db/main/admin.py b/db/main/admin.py
index 0bf09a4..8f4028f 100644
--- a/db/main/admin.py
+++ b/db/main/admin.py
@@ -11,3 +11,8 @@ class PostModelAdmin(OrderableAdmin, admin.ModelAdmin):
list_editable = ['ordering']
ordering_field_hide_input = True
exclude = ['ordering']
+
+
+@admin.register(GrandPrixW)
+class GrandPrixWAdmin(admin.ModelAdmin):
+ list_display = ('__str__', 'link', 'published', 'current')
diff --git a/db/main/migrations/0007_remove_grandprixw_id_grandprixw_current_and_more.py b/db/main/migrations/0007_remove_grandprixw_id_grandprixw_current_and_more.py
new file mode 100644
index 0000000..a747f9a
--- /dev/null
+++ b/db/main/migrations/0007_remove_grandprixw_id_grandprixw_current_and_more.py
@@ -0,0 +1,32 @@
+# Generated by Django 4.0.5 on 2023-01-18 21:57
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('main', '0006_grandprixw_buttons_post_buttons'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='grandprixw',
+ name='id',
+ ),
+ migrations.AddField(
+ model_name='grandprixw',
+ name='current',
+ field=models.BooleanField(default=False, verbose_name='Aktualne GP (pokazywane na stronie głównej)'),
+ ),
+ migrations.AddField(
+ model_name='grandprixw',
+ name='published',
+ field=models.BooleanField(default=True, verbose_name='Grand Prix opublikowane'),
+ ),
+ migrations.AddField(
+ model_name='grandprixw',
+ name='year',
+ field=models.IntegerField(default=1, primary_key=True, serialize=False, verbose_name='Rok'),
+ ),
+ ]
diff --git a/db/main/models.py b/db/main/models.py
index aec68b2..82e8b26 100644
--- a/db/main/models.py
+++ b/db/main/models.py
@@ -54,14 +54,32 @@ class Post(OrderableModel):
verbose_name_plural = 'Aktualności PodlZBS'
-class GrandPrixW(SingletonModel):
+class GrandPrixW(models.Model):
+ published = models.BooleanField('Grand Prix opublikowane', default=True)
+ year = models.IntegerField('Rok', primary_key=True, default=1)
content = HTMLField('Tekst GPW', default='', blank=True)
buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text)
+ current = models.BooleanField(
+ 'Aktualne GP (pokazywane na stronie głównej)', default=False)
+
+ @staticmethod
+ def get_current():
+ return GrandPrixW.objects.filter(current=True, published=True).first()
+
+ def update(self, *args, **kwargs):
+ if self.current is True:
+ GrandPrixW.objects.exclude(year=self.year).update(current=False)
def __str__(self):
- return 'Grand Prix Województwa'
+ return f'Grand Prix Województwa {self.year}'
+
+ @property
+ def link(self):
+ href = reverse_lazy('gpw-reverse', args=[self.year])
+ return mark_safe(f'{href}')
class Meta:
verbose_name = 'Grand Prix Województwa'
verbose_name_plural = 'Grand Prix Województwa'
+ ordering = ['-year']
diff --git a/theme/static/css/dist/styles.css b/theme/static/css/dist/styles.css
index 2cb48a7..ff80b20 100644
--- a/theme/static/css/dist/styles.css
+++ b/theme/static/css/dist/styles.css
@@ -1081,6 +1081,22 @@ select {
margin-bottom: 0;
}
+.btn {
+ display: inline-block;
+ border-radius: 0.375rem;
+ border-width: 1px;
+ -webkit-text-decoration-line: none;
+ text-decoration-line: none;
+ --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
+ --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
+ transition-property: color, background-color, border-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-text-decoration-color, -webkit-backdrop-filter;
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-text-decoration-color, -webkit-backdrop-filter;
+ transition-duration: 300ms;
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
+}
+
.button {
display: inline-block;
border-radius: 0.375rem;
@@ -1295,6 +1311,10 @@ select {
margin: 1rem;
}
+.m-0 {
+ margin: 0px;
+}
+
.mx-auto {
margin-left: auto;
margin-right: auto;
@@ -1310,6 +1330,21 @@ select {
margin-bottom: 0.5rem;
}
+.my-5 {
+ margin-top: 1.25rem;
+ margin-bottom: 1.25rem;
+}
+
+.my-3 {
+ margin-top: 0.75rem;
+ margin-bottom: 0.75rem;
+}
+
+.my-6 {
+ margin-top: 1.5rem;
+ margin-bottom: 1.5rem;
+}
+
.mb-2 {
margin-bottom: 0.5rem;
}
@@ -1334,6 +1369,10 @@ select {
margin-bottom: auto;
}
+.ml-2 {
+ margin-left: 0.5rem;
+}
+
.block {
display: block;
}
@@ -1366,6 +1405,10 @@ select {
display: none;
}
+.h-auto {
+ height: auto;
+}
+
.h-screen {
height: 100vh;
}