[func] reverse pages

[refactor] views and urls
[fix] reorder leagues
main
yaemiku 2022-08-18 01:31:41 +02:00
parent 46943dc359
commit 0e7f67eeb9
Signed by: podlaskizbs
GPG Key ID: ADC039636B3E4AAB
54 changed files with 377 additions and 225 deletions

View File

@ -1,12 +0,0 @@
08.06.2022 - 1h 37 mins
09.06.2022 - 1h
12.06.2022 - 1h 15 mins
15.06.2022 - 1h 30 mins
23.06.2022 - 1h 30 mins
07.07.2022 - 2h 30 mins
15.07.2022 - 3h
24.07.2022 - 3h 30 mins
25.07.2022 - 3h 30 mins
26.07.2022 - 1h 30 mins
27.07.2022 - 4h
01.08.2022 - 30 mins

View File

@ -25,8 +25,8 @@ def load_config(request):
'regulaminy': Regulation.objects.all(), 'regulaminy': Regulation.objects.all(),
'rodos': RODO.objects.all(), 'rodos': RODO.objects.all(),
'leagues': { 'leagues': {
'Wyniki I Ligi': FirstLeague.objects.all().reverse(), 'Wyniki I Ligi': FirstLeague.objects.all(),
'Wyniki II Ligi': SecondLeague.objects.all().reverse(), 'Wyniki II Ligi': SecondLeague.objects.all(),
'Wyniki III Ligi': ThirdLeague.objects.all() 'Wyniki III Ligi': ThirdLeague.objects.all()
}, },
'calendars': Calendar.objects.all(), 'calendars': Calendar.objects.all(),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -2,10 +2,8 @@
<!----> <!---->
{% block title %}ATU | pdlzbs{% endblock %} {% block title %}ATU | pdlzbs{% endblock %}
<!----> <!---->
{% load static tailwind_tags tablepipe %} {% block content %} {% load static tailwind_tags wysiwyg %} {% block content %}
<div class="flex"> <div class="flex">
<article class="max-w-full mx-auto scrollable"> <article class="max-w-full mx-auto scrollable">{% content atu %}</article>
{{ atu.content | tablescroll | safe }}
</article>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -10,6 +10,20 @@
<meta name="description" content="Podlaski Związek Brydża Sportowego" /> <meta name="description" content="Podlaski Związek Brydża Sportowego" />
<meta name="author" content="Mikołaj Kubiczek" /> <meta name="author" content="Mikołaj Kubiczek" />
<link rel="icon" href="{% static 'favicon.ico' %}" type="image/x-icon" />
<link
rel="icon"
type="image/png"
sizes="192x192"
href="{% static 'icon-192x192.png' %}"
/>
<link
rel="icon"
type="image/png"
sizes="512x512"
href="{% static 'icon-512x512.png' %}"
/>
<title> <title>
{% block title %}Podlaski Związek Brydża Sportowego{% endblock %} {% block title %}Podlaski Związek Brydża Sportowego{% endblock %}
</title> </title>
@ -75,7 +89,7 @@
</div> </div>
</header> </header>
<main <main
class="container xl:max-w-screen-xl mx-auto p-4 prose-img:m-1 prose-p:my-[0.3em]" class="container xl:max-w-screen-xl mx-auto p-4 prose-img:my-1 prose-p:my-[0.3em]"
> >
{% block content %}{% endblock %} {% block content %}{% endblock %}
</main> </main>

View File

@ -1,11 +1,9 @@
{% extends 'base.html' %} {% block title %}Kalendarz | pdlzbs{% endblock %} {% extends 'base.html' %} {% block title %}Kalendarz | pdlzbs{% endblock %}
<!----> <!---->
{% load static tailwind_tags tablepipe %} {% block content %} {% load static tailwind_tags wysiwyg %} {% block content %}
<div class="flex flex-col items-center gap-4"> <div class="flex flex-col items-center gap-4">
{% for calendar in calendars %} {% for calendar in calendars %}
<article class="w-full pb-4"> <article class="w-full pb-4">{% content calendar %}</article>
{{ calendar.content | tablescroll | safe }}
</article>
{% if not forloop.last %} {% if not forloop.last %}
<hr class="w-36 border-b border-stone-200" /> <hr class="w-36 border-b border-stone-200" />
{% endif %} {% empty %} {% endif %} {% empty %}

View File

@ -2,6 +2,6 @@
<!----> <!---->
{% block title %}Grand Prix Białegostoku | pdlzbs{% endblock %} {% block title %}Grand Prix Białegostoku | pdlzbs{% endblock %}
<!----> <!---->
{% load static tailwind_tags tablepipe %} {% block content %} {% load static tailwind_tags wysiwyg %} {% block content %}
<article class="w-full">{{ gpb.content | tablescroll | safe }}</article> <article class="w-full">{% content gpb %}</article>
{% endblock %} {% endblock %}

View File

@ -0,0 +1,14 @@
{% extends 'base.html' %}
<!---->
{% block title %}{{ focus.title | default:"-" }} | pdlzbs{% endblock %}
<!---->
{% load static tailwind_tags wysiwyg %} {% block content %}
<div class="flex flex-col lg:flex-row justify-center gap-8">
<article class="prose bg-white shadow-md rounded-md p-8">
{% if focus.show_title %}
<h1 class="font-medium text-center">{{ focus.title }}</h1>
{% endif %}
<div>{% content focus %}</div>
</article>
</div>
{% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'base.html' %} {% block title %}Strona główna | pdlzbs{% endblock %} {% extends 'base.html' %} {% block title %}Strona główna | pdlzbs{% endblock %}
{% load static tailwind_tags tablepipe %} {% block content %} {% load static tailwind_tags wysiwyg %} {% block content %}
<div class="flex flex-col lg:flex-row justify-center gap-8"> <div class="flex flex-col lg:flex-row justify-center gap-8">
<article <article
class="basis-1/2 prose max-w-screen-sm mb-auto bg-white shadow-md rounded-md p-4" class="basis-1/2 prose max-w-screen-sm mb-auto bg-white shadow-md rounded-md p-4"
> >
{{ gpw.content | tablescroll | safe }} {% content gpw %}
</article> </article>
<div class="basis-1/2 flex flex-col items-center gap-4"> <div class="basis-1/2 flex flex-col items-center gap-4">
<h1 <h1
@ -20,7 +20,7 @@
{% if post.show_title %} {% if post.show_title %}
<h2 class="font-medium">{{ post.title }}</h2> <h2 class="font-medium">{{ post.title }}</h2>
{% endif %} {% endif %}
<div>{{ post.content | tablescroll | safe }}</div> <div>{% readmore post %}</div>
</article> </article>
{% if not forloop.last %} {% if not forloop.last %}
<hr class="w-36 border-b border-stone-200" /> <hr class="w-36 border-b border-stone-200" />

View File

@ -2,7 +2,7 @@
<!----> <!---->
{% block title %}Miejski Białostocki Klub Brydżowy | pdlzbs{% endblock %} {% block title %}Miejski Białostocki Klub Brydżowy | pdlzbs{% endblock %}
<!----> <!---->
{% load static tailwind_tags tablepipe %} {% block content %} {% load static tailwind_tags wysiwyg %} {% block content %}
<h1 class="text-center mb-4">Miejski Białostocki Klub Brydżowy</h1> <h1 class="text-center mb-4">Miejski Białostocki Klub Brydżowy</h1>
<div class="flex flex-col items-center gap-4"> <div class="flex flex-col items-center gap-4">
@ -10,7 +10,7 @@
<article class="w-full pb-4"> <article class="w-full pb-4">
{% if article.show_title %} {% if article.show_title %}
<h2 class="font-normal">{{ article.title }}</h2> <h2 class="font-normal">{{ article.title }}</h2>
{% endif %} {{ article.content | tablescroll | safe }} {% endif %} {% content article %}
</article> </article>
{% if not forloop.last %} {% if not forloop.last %}
<hr class="w-36 border-b border-stone-200" /> <hr class="w-36 border-b border-stone-200" />

View File

@ -2,10 +2,10 @@
<!----> <!---->
{% block title %}Składki Członkowskie | pdlzbs{% endblock %} {% block title %}Składki Członkowskie | pdlzbs{% endblock %}
<!----> <!---->
{% load static tailwind_tags tablepipe %} {% block content %} {% load static tailwind_tags wysiwyg %} {% block content %}
<div class="flex flex-col items-center gap-4"> <div class="flex flex-col items-center gap-4">
{% for membership in memberships %} {% for membership in memberships %}
<article class="w-full pb-4">{{ membership.content | safe }}</article> <article class="w-full pb-4">{% content membership %}</article>
{% if not forloop.last %} {% if not forloop.last %}
<hr class="w-36 border-b border-stone-200" /> <hr class="w-36 border-b border-stone-200" />
{% endif %} {% empty %} {% endif %} {% empty %}

View File

@ -0,0 +1,27 @@
{% extends 'base.html' %}
<!---->
{% block title %}{{ focus.title | default:"-" }} | pdlzbs{% endblock %}
<!---->
{% load static tailwind_tags wysiwyg %} {% block content %}
<div class="flex flex-col items-center gap-4">
<article
class="prose w-full max-w-screen-md bg-white rounded-md shadow-md p-4"
>
{% if focus.show_title %}
<h1 class="font-medium text-center">{{ focus.title }}</h1>
{% endif %}
<div class="flex flex-wrap gap-4 items-center justify-center">
{% buttons focus.buttons %}
</div>
<figure class="flex flex-col">
<a href="{{ focus.link }}" target="_blank" class="mx-auto"
><img
src="{{ focus.photo.url }}"
alt=""
class="max-h-72 inline-block text-center"
/></a>
<figcaption>{% content focus %}</figcaption>
</figure>
</article>
</div>
{% endblock %}

View File

@ -1,33 +1,31 @@
{% extends 'base.html' %} {% extends 'base.html' %}
<!----> <!---->
{% block title %}Składki Członkowskie | pdlzbs{% endblock %} {% block title %}Inne turnieje | pdlzbs{% endblock %}
<!----> <!---->
{% load static tailwind_tags tablepipe %} {% block content %} {% load static tailwind_tags wysiwyg %} {% block content %} {% if tournaments %}
<h1 class="text-center mb-4">Inne turnieje</h1>
{% if tournaments %}
<div class="flex flex-col items-center gap-4"> <div class="flex flex-col items-center gap-4">
{% for tournament in tournaments %} {% for tournament in tournaments %}
<article <article
class="prose prose-a:text-center w-full max-w-screen-md bg-white rounded-md shadow-md p-4 pb-6" class="prose w-full max-w-screen-md bg-white rounded-md shadow-md p-4"
> >
{% if tournament.show_title %} {% if tournament.show_title %}
<h2>{{ tournament.title }}</h2> <h2 class="font-medium text-center">{{ tournament.title }}</h2>
{% endif %} {% endif %}
<figure> <div class="flex flex-wrap gap-4 items-center justify-center">
<a href="{{ tournament.link }}" target="_blank" {% buttons tournament.buttons %}
><img src="{{ tournament.photo.url }}" alt="" class="max-h-72 mx-auto" </div>
/></a> <figure class="flex flex-col">
<figcaption>{{ tournament.content | safe }}</figcaption>
</figure>
<p class="text-center">
<a <a
href="{{ tournament.link }}" href="{{ tournament.buttons | firstbutton }}"
target="_blank" target="_blank"
class="inline px-16 button red color" class="mx-auto"
> ><img
{{ tournament.link_title | default:"Wyniki" }} src="{{ tournament.photo.url }}"
</a> alt=""
</p> class="max-h-72 text-center"
/></a>
<figcaption>{% content tournament %}</figcaption>
</figure>
</article> </article>
{% if not forloop.last %} {% if not forloop.last %}
<hr class="w-36 border-b border-stone-200" /> <hr class="w-36 border-b border-stone-200" />

View File

@ -0,0 +1,19 @@
{% extends 'base.html' %}
<!---->
{% block title %}{{ focus.title | default:"-" }} | pdlzbs{% endblock %}
<!---->
{% load static tailwind_tags wysiwyg %} {% block content %}
<div class="flex flex-col items-center gap-4">
<article
class="prose w-full max-w-screen-md bg-white rounded-md shadow-md p-4"
>
{% if focus.show_title %}
<h1 class="font-medium text-center">{{ focus.title }}</h1>
{% endif %}
<div class="flex flex-wrap gap-4 items-center justify-center">
{% buttons focus.buttons %}
</div>
{% content focus %}
</article>
</div>
{% endblock %}

View File

@ -2,15 +2,19 @@
<!----> <!---->
{% block title %}Młodzież | pdlzbs{% endblock %} {% block title %}Młodzież | pdlzbs{% endblock %}
<!----> <!---->
{% load static tailwind_tags tablepipe %} {% block content %} {% load static tailwind_tags wysiwyg %} {% block content %}
<h1 class="text-center mb-4">Młodzież</h1>
<div class="flex flex-col items-center gap-4"> <div class="flex flex-col items-center gap-4">
{% for article in youth %} {% for article in youth %}
<article class="w-full pb-4"> <article
class="prose w-full max-w-screen-md bg-white rounded-md shadow-md p-4"
>
{% if article.show_title %} {% if article.show_title %}
<h2 class="font-normal">{{ article.title }}</h2> <h1 class="font-medium text-center">{{ article.title }}</h1>
{% endif %} {{ article.content | tablescroll | safe }} {% endif %}
<div class="flex flex-wrap gap-4 items-center justify-center">
{% buttons article.buttons %}
</div>
{% content article %}
</article> </article>
{% if not forloop.last %} {% if not forloop.last %}
<hr class="w-36 border-b border-stone-200" /> <hr class="w-36 border-b border-stone-200" />

View File

@ -1,10 +0,0 @@
from django import template
import re
register = template.Library()
@register.filter(name='tablescroll')
def get_due_date_string(value):
a = re.sub(r'<table[^>]*?>', '<div style="overflow-x: auto">\g<0>', value)
return re.sub(r'<\/table>', '</table></div>', a)

View File

@ -0,0 +1,64 @@
from django import template
from django.urls.base import reverse_lazy, resolve
from django.utils.safestring import mark_safe
import re
register = template.Library()
@register.filter
def tableoverflow(value):
return re.sub(r'<\/table>', '</table></div>', re.sub(r'<table[^>]*?>', '<div style="overflow-x: auto">\g<0>', value)) if value else ''
@register.simple_tag(takes_context=True)
def readmore(context, value: str):
current_view = resolve(context.request.path).url_name
if 'reverse' not in current_view:
reverse_view_url = reverse_lazy(
current_view + '-reverse', args=(value.id,))
res = value.content.split('<!-- pagebreak -->')
cntnt = res[0]
if len(res) > 1:
cntnt += f'<br /><br /><p class="text-center">...</p><a href="{reverse_view_url}" style="float: right;" class="button mt-4">Czytaj dalej</a>'
return mark_safe(tableoverflow(cntnt))
@register.simple_tag()
def content(value: str):
return mark_safe(tableoverflow(value.content))
@register.simple_tag()
def buttons(value: str):
lines = value.split('\n')
def parse(line: str) -> str:
try:
if '->' in line:
text, url = line.split('->')
return f'<a href={url} target="_blank" rel="norefferer noopener" class="inline px-12 py-2 button red color">{text}</a>'
else:
text, url = line.split('|')
return f'<a href={url} target="_self" class="inline px-12 py-3 button red color">{text}</a>'
except:
return ''
return mark_safe(''.join([parse(line) for line in lines]))
@register.filter()
def firstbutton(value: str):
lines = value.split('\n')
def parse(line: str) -> str:
try:
text, url = line.split('|' if '|' in line else '->')
return url
except:
return ''
return mark_safe(parse(lines[0]))

View File

@ -1,23 +1,28 @@
from django.urls import path from django.urls import path
from .views import * from .views import rtpath, tpath
from db.main.models import Post
from db.tournaments.models import Tournament
from db.youth.models import Youth
urlpatterns = [ urlpatterns = [
path('', HomeView.as_view(), name='home'), tpath('', 'home', {'home': 'active'}),
path('zarzad', AdministrationView.as_view(), name='administration'), rtpath('aktualnosci/<int:id>', 'home', Post, {'home': 'active'}),
path('zarzad/ogloszenia', AdministrationAnnouncementsView.as_view(),
name='administration_announcements'), tpath('zarzad', 'administration'),
path('zarzad/protokolyiuchwaly', AdministrationProtocolsView.as_view(), tpath('zarzad/ogloszenia', 'administration/announcements'),
name='administration_protocols'), tpath('zarzad/protokolyiuchwaly', 'administration/protocols'),
path('zarzad/regulaminy', AdministrationRegulationsView.as_view(), tpath('zarzad/regulaminy', 'administration/regulations'),
name='administration_regulations'), tpath('zarzad/rodo', 'administration/rodos'),
path('zarzad/rodo', AdministrationRODOView.as_view(),
name='administration_rodos'), tpath('ligi', 'league'),
path('ligi', LeagueView.as_view(), name='league'), tpath('kalendarz', 'calendar'),
path('kalendarz', CalendarView.as_view(), name='calendar'), tpath('grandprixbialegostoku', 'grandprix'),
path('grandprixbialegostoku', GrandPrixView.as_view(), name='gpx'), tpath('inneturnieje', 'tournaments'),
path('inneturnieje', TournamentView.as_view(), name='tournaments'), rtpath('inneturnieje/<int:id>', 'tournaments', Tournament),
path('skladki', MembershipView.as_view(), name='membership'), tpath('skladki', 'membership'),
path('mlodziez', YouthView.as_view(), name='youth'), tpath('mlodziez', 'youth'),
path('atu', AtuView.as_view(), name='atu'), rtpath('mlodziez/<int:id>', 'youth', Youth),
path('mbkb', MBKBView.as_view(), name='mbkb'), tpath('atu', 'atu'),
tpath('mbkb', 'mbkb'),
] ]

View File

@ -1,65 +1,26 @@
from django.shortcuts import render from django.shortcuts import render
from django.views.generic import TemplateView from django.urls import path
import importlib
import pkgutil
# Create your views here. # Create your views here.
def template(filename, ec={}):
def closure(request):
return render(request, filename+'.html', ec)
class HomeView(TemplateView): return closure
template_name = 'home.html'
extra_context = {
'home': 'active'
}
class AdministrationView(TemplateView): def reverse_template(filename, model, ec={}):
template_name = 'administration.html' def closure(request, id):
return render(request, filename+'-reverse.html', {**ec, 'focus': model.objects.get(id=id)})
return closure
class AdministrationAnnouncementsView(TemplateView): def tpath(p: str, filename: str, ec={}):
template_name = 'administration/announcements.html' return path(p, template(filename, ec), name=filename.replace('/', '_'))
class AdministrationProtocolsView(TemplateView): def rtpath(p: str, filename: str, model, ec={}):
template_name = 'administration/protocols.html' return path(p, reverse_template(filename, model, ec), name=filename.replace('/', '_')+'-reverse')
class AdministrationRegulationsView(TemplateView):
template_name = 'administration/regulations.html'
class AdministrationRODOView(TemplateView):
template_name = 'administration/rodos.html'
class LeagueView(TemplateView):
template_name = 'league.html'
class CalendarView(TemplateView):
template_name = 'calendar.html'
class GrandPrixView(TemplateView):
template_name = 'grandprix.html'
class TournamentView(TemplateView):
template_name = "tournaments.html"
class MembershipView(TemplateView):
template_name = 'membership.html'
class YouthView(TemplateView):
template_name = "youth.html"
class AtuView(TemplateView):
template_name = 'atu.html'
class MBKBView(TemplateView):
template_name = "mbkb.html"

View File

@ -7,7 +7,7 @@ from .models import *
@admin.register(Post) @admin.register(Post)
class PostModelAdmin(OrderableAdmin, admin.ModelAdmin): class PostModelAdmin(OrderableAdmin, admin.ModelAdmin):
list_display = ['__str__', 'ordering'] list_display = ['__str__', 'link', 'ordering']
list_editable = ['ordering'] list_editable = ['ordering']
ordering_field_hide_input = True ordering_field_hide_input = True
exclude = ['ordering'] exclude = ['ordering']

View File

@ -1,4 +1,6 @@
from django.db import models from django.db import models
from django.urls.base import reverse_lazy
from django.utils.safestring import mark_safe
from tinymce.models import HTMLField from tinymce.models import HTMLField
from admin_ordering.models import OrderableModel from admin_ordering.models import OrderableModel
from core.utils import SingletonModel from core.utils import SingletonModel
@ -16,6 +18,11 @@ class Post(OrderableModel):
def __str__(self): def __str__(self):
return self.title or '(brak tytułu)' return self.title or '(brak tytułu)'
@property
def link(self):
href = reverse_lazy('home-reverse', args=[self.id])
return mark_safe(f'<a href="{href}" target="_blank">{href}</a>')
class Meta(OrderableModel.Meta): class Meta(OrderableModel.Meta):
verbose_name = 'Aktualność PodlZBS' verbose_name = 'Aktualność PodlZBS'
verbose_name_plural = 'Aktualności PodlZBS' verbose_name_plural = 'Aktualności PodlZBS'

View File

@ -7,7 +7,7 @@ from .models import *
@admin.register(Tournament) @admin.register(Tournament)
class TournamentModelAdmin(OrderableAdmin, admin.ModelAdmin): class TournamentModelAdmin(OrderableAdmin, admin.ModelAdmin):
list_display = ['__str__', 'ordering'] list_display = ['__str__', 'link', 'ordering']
list_editable = ['ordering'] list_editable = ['ordering']
ordering_field_hide_input = True ordering_field_hide_input = True
exclude = ['ordering'] exclude = ['ordering']

View File

@ -0,0 +1,26 @@
# Generated by Django 4.0.5 on 2022-08-17 21:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tournaments', '0005_tournament_link_title_tournament_published_and_more'),
]
operations = [
migrations.RemoveField(
model_name='tournament',
name='link',
),
migrations.RemoveField(
model_name='tournament',
name='link_title',
),
migrations.AddField(
model_name='tournament',
name='buttons',
field=models.TextField(blank=True, default='', verbose_name='Przyciski'),
),
]

View File

@ -1,10 +1,31 @@
from django.db import models from django.db import models
from django.urls.base import reverse_lazy
from django.utils.safestring import mark_safe
from admin_ordering.models import OrderableModel from admin_ordering.models import OrderableModel
from tinymce.models import HTMLField from tinymce.models import HTMLField
from filebrowser.fields import FileBrowseField from filebrowser.fields import FileBrowseField
# 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
teskt2 | 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 link w nowej karcie
""".replace('\n', '<br />')
class Tournament(OrderableModel): class Tournament(OrderableModel):
published = models.BooleanField('Wpis opublikowany', default=True) published = models.BooleanField('Wpis opublikowany', default=True)
@ -13,13 +34,17 @@ class Tournament(OrderableModel):
photo = FileBrowseField( photo = FileBrowseField(
'Zdjęcie', directory='inneturnieje/', max_length=200, blank=True) 'Zdjęcie', directory='inneturnieje/', max_length=200, blank=True)
content = HTMLField('Tekst', default='', blank=True) content = HTMLField('Tekst', default='', blank=True)
link = models.TextField('Link do wyników') buttons = models.TextField(
link_title = models.CharField( 'Przyciski', default='', blank=True, help_text=buttons_help_text)
'Tytuł linku', default='', blank=True, max_length=250)
def __str__(self): def __str__(self):
return self.title or '(brak tytułu)' return self.title or '(brak tytułu)'
@property
def link(self):
href = reverse_lazy('youth-reverse', args=[self.id])
return mark_safe(f'<a href="{href}" target="_blank">{href}</a>')
class Meta(OrderableModel.Meta): class Meta(OrderableModel.Meta):
verbose_name = 'Inny turniej' verbose_name = 'Inny turniej'
verbose_name_plural = 'Inne turnieje' verbose_name_plural = 'Inne turnieje'

View File

@ -7,7 +7,7 @@ from .models import *
@admin.register(Youth) @admin.register(Youth)
class YouthModelAdmin(OrderableAdmin, admin.ModelAdmin): class YouthModelAdmin(OrderableAdmin, admin.ModelAdmin):
list_display = ['__str__', 'ordering'] list_display = ['__str__', 'link', 'ordering']
list_editable = ['ordering'] list_editable = ['ordering']
ordering_field_hide_input = True ordering_field_hide_input = True
exclude = ['ordering'] exclude = ['ordering']

View File

@ -0,0 +1,18 @@
# Generated by Django 4.0.5 on 2022-08-17 21:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('youth', '0002_alter_youth_options_youth_ordering_youth_published_and_more'),
]
operations = [
migrations.AddField(
model_name='youth',
name='buttons',
field=models.TextField(blank=True, default='', verbose_name='Przyciski'),
),
]

View File

@ -1,19 +1,46 @@
from django.db import models from django.db import models
from django.urls.base import reverse_lazy
from django.utils.safestring import mark_safe
from tinymce.models import HTMLField from tinymce.models import HTMLField
from admin_ordering.models import OrderableModel from admin_ordering.models import OrderableModel
# 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
teskt2 | 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
""".replace('\n', '<br />')
class Youth(OrderableModel): class Youth(OrderableModel):
published = models.BooleanField('Wpis opublikowany', default=True) published = models.BooleanField('Wpis opublikowany', default=True)
show_title = models.BooleanField('Pokaż tytuł', default=True) show_title = models.BooleanField('Pokaż tytuł', default=True)
title = models.CharField('Tytuł', default='', blank=True, max_length=250) title = models.CharField('Tytuł', default='', blank=True, max_length=250)
content = HTMLField('Tekst', default='', blank=True) content = HTMLField('Tekst', default='', blank=True)
buttons = models.TextField(
'Przyciski', default='', blank=True, help_text=buttons_help_text)
def __str__(self): def __str__(self):
return self.title or '(brak tytułu)' return self.title or '(brak tytułu)'
@property
def link(self):
href = reverse_lazy('youth-reverse', args=[self.id])
return mark_safe(f'<a href="{href}" target="_blank">{href}</a>')
class Meta(OrderableModel.Meta): class Meta(OrderableModel.Meta):
verbose_name = 'Młodzież' verbose_name = 'Młodzież'
verbose_name_plural = 'Młodzież' verbose_name_plural = 'Młodzież'

View File

@ -153,7 +153,7 @@ TINYMCE_DEFAULT_CONFIG = {
"height": "320px", "height": "320px",
"width": "960px", "width": "960px",
"menubar": "file edit view insert format tools table help", "menubar": "file edit view insert format tools table help",
"plugins": "advlist autolink lists link image charmap print preview anchor searchreplace visualblocks code " "plugins": "advlist autolink lists link image charmap print preview anchor searchreplace visualblocks code pagebreak "
"fullscreen insertdatetime media table paste code help wordcount spellchecker", "fullscreen insertdatetime media table paste code help wordcount spellchecker",
"toolbar": "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft " "toolbar": "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft "
"aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor " "aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor "

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -1300,18 +1300,22 @@ select {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.mt-8 {
margin-top: 2rem;
}
.mb-auto { .mb-auto {
margin-bottom: auto; margin-bottom: auto;
} }
.mt-4 {
margin-top: 1rem;
}
.block { .block {
display: block; display: block;
} }
.inline-block {
display: inline-block;
}
.inline { .inline {
display: inline; display: inline;
} }
@ -1336,14 +1340,6 @@ select {
display: none; display: none;
} }
.h-\[40px\] {
height: 40px;
}
.h-full {
height: 100%;
}
.h-screen { .h-screen {
height: 100vh; height: 100vh;
} }
@ -1364,10 +1360,6 @@ select {
width: 100%; width: 100%;
} }
.w-\[48px\] {
width: 48px;
}
.w-36 { .w-36 {
width: 9rem; width: 9rem;
} }
@ -1388,10 +1380,6 @@ select {
max-width: 768px; max-width: 768px;
} }
.shrink-0 {
flex-shrink: 0;
}
.basis-1\/2 { .basis-1\/2 {
flex-basis: 50%; flex-basis: 50%;
} }
@ -1520,6 +1508,10 @@ select {
padding: 0.5rem; padding: 0.5rem;
} }
.p-8 {
padding: 2rem;
}
.px-4 { .px-4 {
padding-left: 1rem; padding-left: 1rem;
padding-right: 1rem; padding-right: 1rem;
@ -1540,9 +1532,9 @@ select {
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
} }
.px-16 { .px-12 {
padding-left: 4rem; padding-left: 3rem;
padding-right: 4rem; padding-right: 3rem;
} }
.pb-1 { .pb-1 {
@ -1553,10 +1545,6 @@ select {
padding-bottom: 1rem; padding-bottom: 1rem;
} }
.pb-6 {
padding-bottom: 1.5rem;
}
.text-left { .text-left {
text-align: left; text-align: left;
} }
@ -1593,10 +1581,6 @@ select {
font-size: 15px; font-size: 15px;
} }
.text-\[13px\] {
font-size: 13px;
}
.text-\[2\.25rem\] { .text-\[2\.25rem\] {
font-size: 2.25rem; font-size: 2.25rem;
} }
@ -1614,8 +1598,8 @@ select {
font-weight: 300; font-weight: 300;
} }
.font-bold { .font-normal {
font-weight: 700; font-weight: 400;
} }
.font-semibold { .font-semibold {
@ -1642,11 +1626,6 @@ select {
letter-spacing: 0em; letter-spacing: 0em;
} }
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}
.antialiased { .antialiased {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
@ -1821,14 +1800,15 @@ h4 {
margin-bottom: 0.3em; margin-bottom: 0.3em;
} }
.prose-a\:text-center :is(:where(a):not(:where([class~="not-prose"] *))) {
text-align: center;
}
.prose-img\:m-1 :is(:where(img):not(:where([class~="not-prose"] *))) { .prose-img\:m-1 :is(:where(img):not(:where([class~="not-prose"] *))) {
margin: 0.25rem; margin: 0.25rem;
} }
.prose-img\:my-1 :is(:where(img):not(:where([class~="not-prose"] *))) {
margin-top: 0.25rem;
margin-bottom: 0.25rem;
}
@media (min-width: 1024px) { @media (min-width: 1024px) {
.lg\:w-screen { .lg\:w-screen {
width: 100vw; width: 100vw;

BIN
static/favicon.ico 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

BIN
static/logo.jpg 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1304,10 +1304,18 @@ select {
margin-bottom: auto; margin-bottom: auto;
} }
.mt-4 {
margin-top: 1rem;
}
.block { .block {
display: block; display: block;
} }
.inline-block {
display: inline-block;
}
.inline { .inline {
display: inline; display: inline;
} }
@ -1500,6 +1508,10 @@ select {
padding: 0.5rem; padding: 0.5rem;
} }
.p-8 {
padding: 2rem;
}
.px-4 { .px-4 {
padding-left: 1rem; padding-left: 1rem;
padding-right: 1rem; padding-right: 1rem;
@ -1520,9 +1532,9 @@ select {
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
} }
.px-16 { .px-12 {
padding-left: 4rem; padding-left: 3rem;
padding-right: 4rem; padding-right: 3rem;
} }
.pb-1 { .pb-1 {
@ -1533,10 +1545,6 @@ select {
padding-bottom: 1rem; padding-bottom: 1rem;
} }
.pb-6 {
padding-bottom: 1.5rem;
}
.text-left { .text-left {
text-align: left; text-align: left;
} }
@ -1590,14 +1598,14 @@ select {
font-weight: 300; font-weight: 300;
} }
.font-semibold {
font-weight: 600;
}
.font-normal { .font-normal {
font-weight: 400; font-weight: 400;
} }
.font-semibold {
font-weight: 600;
}
.lowercase { .lowercase {
text-transform: lowercase; text-transform: lowercase;
} }
@ -1792,14 +1800,15 @@ h4 {
margin-bottom: 0.3em; margin-bottom: 0.3em;
} }
.prose-a\:text-center :is(:where(a):not(:where([class~="not-prose"] *))) {
text-align: center;
}
.prose-img\:m-1 :is(:where(img):not(:where([class~="not-prose"] *))) { .prose-img\:m-1 :is(:where(img):not(:where([class~="not-prose"] *))) {
margin: 0.25rem; margin: 0.25rem;
} }
.prose-img\:my-1 :is(:where(img):not(:where([class~="not-prose"] *))) {
margin-top: 0.25rem;
margin-bottom: 0.25rem;
}
@media (min-width: 1024px) { @media (min-width: 1024px) {
.lg\:w-screen { .lg\:w-screen {
width: 100vw; width: 100vw;

View File

@ -1,29 +1,9 @@
/**
* This is a minimal config.
*
* If you need the full config, get it from here:
* https://unpkg.com/browse/tailwindcss@latest/stubs/defaultConfig.stub.js
*/
module.exports = { module.exports = {
content: [ content: [
/**
* HTML. Paths to Django template files that will contain Tailwind CSS classes.
*/
/* Templates within theme app (<tailwind_app_name>/templates), e.g. base.html. */
"../templates/**/*.html", "../templates/**/*.html",
/*
* Main templates directory of the project (BASE_DIR/templates).
* Adjust the following line to match your project structure.
*/
"../../../templates/**/*.html", "../../../templates/**/*.html",
/*
* Templates in other django apps (BASE_DIR/<any_app_name>/templates).
* Adjust the following line to match your project structure.
*/
"../../../**/templates/**/*.html", "../../../**/templates/**/*.html",
/** /**
@ -39,7 +19,7 @@ module.exports = {
* Python: If you use Tailwind CSS classes in Python, uncomment the following line * Python: If you use Tailwind CSS classes in Python, uncomment the following line
* and make sure the pattern below matches your project structure. * and make sure the pattern below matches your project structure.
*/ */
// '../../**/*.py' "../../../core/templatetags/*.py",
], ],
theme: { theme: {
extend: {}, extend: {},