[func] unpublish article and don't show title
[func] upper nav buttons [func] /ftp as /mediamain
parent
52e38c5118
commit
a8ba21c33d
|
|
@ -8,4 +8,5 @@
|
|||
24.07.2022 - 3h 30 mins
|
||||
25.07.2022 - 3h 30 mins
|
||||
26.07.2022 - 1h 30 mins
|
||||
27.07.2022 - 4h
|
||||
27.07.2022 - 4h
|
||||
01.08.2022 - 30 mins
|
||||
|
|
@ -16,6 +16,14 @@ class ButtonModelAdmin(OrderableAdmin, admin.ModelAdmin):
|
|||
exclude = ['ordering']
|
||||
|
||||
|
||||
@admin.register(UpperButton)
|
||||
class UpperButtonModelAdmin(OrderableAdmin, admin.ModelAdmin):
|
||||
list_display = ['__str__', 'ordering']
|
||||
list_editable = ['ordering']
|
||||
ordering_field_hide_input = True
|
||||
exclude = ['ordering']
|
||||
|
||||
|
||||
apps = [
|
||||
'main',
|
||||
'administration',
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ from db.atu.models import *
|
|||
def load_config(request):
|
||||
return {
|
||||
'nav': Button.objects.all(),
|
||||
'uppernav': UpperButton.objects.all(),
|
||||
'gpw': GrandPrixW.load(),
|
||||
'posts': Post.objects.all(),
|
||||
'posts': Post.objects.filter(published=True),
|
||||
'czlonkowie': Member.objects.all(),
|
||||
'statut': Statute.objects.first(),
|
||||
'ogloszenia': Announcement.objects.all(),
|
||||
|
|
@ -29,8 +30,8 @@ def load_config(request):
|
|||
},
|
||||
'calendars': Calendar.objects.all(),
|
||||
'gpb': GrandPrixB.load(),
|
||||
'tournaments': Tournament.objects.all(),
|
||||
'memberships': Membership.objects.all(),
|
||||
'tournaments': Tournament.objects.filter(published=True),
|
||||
'memberships': Membership.objects.filter(published=True),
|
||||
'youth': Youth.load(),
|
||||
'atu': Atu.load()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
# Generated by Django 4.0.5 on 2022-07-31 22:37
|
||||
|
||||
from django.db import migrations, models
|
||||
import filebrowser.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0010_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='UpperButton',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ordering', models.IntegerField(default=0, verbose_name='Kolejność')),
|
||||
('title', models.CharField(max_length=50, verbose_name='Tytuł przycisku')),
|
||||
('photo', filebrowser.fields.FileBrowseField(blank=True, max_length=200, verbose_name='Ikona')),
|
||||
('href', models.CharField(max_length=50, verbose_name='Link')),
|
||||
('blank', models.BooleanField(verbose_name='Otwórz w nowej karcie')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Przycisk górny (łabs, atu, itd...)',
|
||||
'verbose_name_plural': 'Przyciski górne (łabs, atu, itd...)',
|
||||
'ordering': ['ordering'],
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='button',
|
||||
options={'ordering': ['ordering'], 'verbose_name': 'Przycisk nawigacji (zielony)', 'verbose_name_plural': 'Przyciski nawigacji (zielone)'},
|
||||
),
|
||||
]
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from django.db import models
|
||||
from tinymce.models import HTMLField
|
||||
from admin_ordering.models import OrderableModel
|
||||
from core.utils import SingletonModel
|
||||
from filebrowser.fields import FileBrowseField
|
||||
|
||||
# Create your models here.
|
||||
|
||||
|
|
@ -15,5 +15,20 @@ class Button(OrderableModel):
|
|||
return self.title or '-'
|
||||
|
||||
class Meta(OrderableModel.Meta):
|
||||
verbose_name = 'Przycisk na stronie głównej'
|
||||
verbose_name_plural = 'Przyciski na stronie głównej'
|
||||
verbose_name = 'Przycisk nawigacji (zielony)'
|
||||
verbose_name_plural = 'Przyciski nawigacji (zielone)'
|
||||
|
||||
|
||||
class UpperButton(OrderableModel):
|
||||
title = models.CharField('Tytuł przycisku', max_length=50)
|
||||
photo = FileBrowseField(
|
||||
'Ikona', directory='gorneprzyciski/', max_length=200, blank=True)
|
||||
href = models.CharField('Link', max_length=50)
|
||||
blank = models.BooleanField('Otwórz w nowej karcie')
|
||||
|
||||
def __str__(self):
|
||||
return self.title or '-'
|
||||
|
||||
class Meta(OrderableModel.Meta):
|
||||
verbose_name = 'Przycisk górny (łabs, atu, itd...)'
|
||||
verbose_name_plural = 'Przyciski górne (łabs, atu, itd...)'
|
||||
|
|
|
|||
|
|
@ -52,46 +52,26 @@
|
|||
</nav>
|
||||
{% endif %}
|
||||
</div>
|
||||
<nav class="flex flex-wrap justify-center items-center gap-6 mt-8">
|
||||
<div title="Cezar">
|
||||
<a href="http://www.msc.com.pl/cezar" target="_blank"
|
||||
><img class="max-h-12" src="{% static 'cezar.gif' %}" alt="Cezar"
|
||||
/></a>
|
||||
</div>
|
||||
<div title="PZBS">
|
||||
<a href="http://www.pzbs.pl" target="_blank"
|
||||
><img src="{% static 'pzbs.webp' %}" alt="PZBS"
|
||||
/></a>
|
||||
</div>
|
||||
<div title="Łomżyńska Akademia Brydża Sportowego">
|
||||
<a href="http://www.labs.lomza.pl/" target="_blank"
|
||||
><img class="max-h-12" src="{% static 'labs.jpg' %}" alt="ŁABS"
|
||||
/></a>
|
||||
</div>
|
||||
<div title="Kareta">
|
||||
<a href="https://kareta.pzbs.pl/" target="_blank"
|
||||
><img
|
||||
class="max-h-12"
|
||||
src="{% static 'kareta.jpg' %}"
|
||||
alt="Kareta"
|
||||
/></a>
|
||||
</div>
|
||||
<div>
|
||||
<a
|
||||
id="atu"
|
||||
href="{% url 'atu' %}"
|
||||
class="h-[40px] w-[48px] items-center text-white"
|
||||
><div class="flex h-full items-center justify-center">
|
||||
<span class="text-[13px] font-bold">ATU</span>
|
||||
</div></a
|
||||
>
|
||||
</div>
|
||||
<div title="Miejski Białostocki Klub Brydżowy">
|
||||
<a href="https://andys0101.wixsite.com/pdlzbs/mbkb"
|
||||
><img src="{% static 'mbkb.webp' %}" alt="MBKB"
|
||||
/></a>
|
||||
</div>
|
||||
{% if uppernav %}
|
||||
<nav>
|
||||
<ul
|
||||
class="flex flex-wrap justify-center lg:items-end gap-3 text-[15px] leading-5 m-2"
|
||||
>
|
||||
{% for button in uppernav %}
|
||||
<li title="{{ button.title }}">
|
||||
<a
|
||||
href="{{ button.href }}"
|
||||
target="{% if button.blank %}_blank{% else %}_self{% endif %}"
|
||||
><img
|
||||
class="max-h-12"
|
||||
src="{{ button.photo.url }}"
|
||||
alt="{{ button.title }}"
|
||||
/></a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
<main
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<article
|
||||
class="prose max-w-full w-full py-4 bg-white shadow-md rounded-md p-4"
|
||||
>
|
||||
{% if post.title %}
|
||||
{% if post.show_title %}
|
||||
<h2 class="font-medium">{{ post.title }}</h2>
|
||||
{% endif %}
|
||||
<div>{{ post.content | tablescroll | safe }}</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<article
|
||||
class="prose prose-a:text-center w-full max-w-screen-md bg-white rounded-md shadow-md p-4 pb-6"
|
||||
>
|
||||
{% if tournament.title %}
|
||||
{% if tournament.show_title %}
|
||||
<h2>{{ tournament.title }}</h2>
|
||||
{% endif %}
|
||||
<figure>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 4.0.5 on 2022-07-31 22:37
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0004_alter_grandprixw_content_alter_post_content'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='post',
|
||||
name='published',
|
||||
field=models.BooleanField(default=True, verbose_name='Wpis opublikowany'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='post',
|
||||
name='show_title',
|
||||
field=models.BooleanField(default=True, verbose_name='Pokaż tytuł'),
|
||||
),
|
||||
]
|
||||
|
|
@ -7,6 +7,8 @@ from core.utils import SingletonModel
|
|||
|
||||
|
||||
class Post(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('Treść', default='', blank=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 4.0.5 on 2022-07-31 22:37
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('membership', '0002_remove_membership_attachment_membership_content'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='membership',
|
||||
name='published',
|
||||
field=models.BooleanField(default=True, verbose_name='Wpis opublikowany'),
|
||||
),
|
||||
]
|
||||
|
|
@ -5,6 +5,7 @@ from tinymce.models import HTMLField
|
|||
|
||||
|
||||
class Membership(models.Model):
|
||||
published = models.BooleanField('Wpis opublikowany', default=True)
|
||||
year = models.IntegerField('Rok', primary_key=True)
|
||||
content = HTMLField('Treść', default='', blank=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
# Generated by Django 4.0.5 on 2022-07-31 22:37
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('tournaments', '0004_alter_tournament_content'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='tournament',
|
||||
name='link_title',
|
||||
field=models.CharField(blank=True, default='', max_length=250, verbose_name='Tytuł linku'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='tournament',
|
||||
name='published',
|
||||
field=models.BooleanField(default=True, verbose_name='Wpis opublikowany'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='tournament',
|
||||
name='show_title',
|
||||
field=models.BooleanField(default=True, verbose_name='Pokaż tytuł'),
|
||||
),
|
||||
]
|
||||
|
|
@ -7,11 +7,15 @@ from filebrowser.fields import FileBrowseField
|
|||
|
||||
|
||||
class Tournament(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)
|
||||
photo = FileBrowseField(
|
||||
'Zdjęcie', directory='inneturnieje/', max_length=200, blank=True)
|
||||
title = models.CharField('Tytuł', default='', blank=True, max_length=250)
|
||||
content = HTMLField('Tekst', default='', blank=True)
|
||||
link = models.TextField('Link do wyników')
|
||||
link_title = models.CharField(
|
||||
'Tytuł linku', default='', blank=True, max_length=250)
|
||||
|
||||
def __str__(self):
|
||||
return self.title or '(brak tytułu)'
|
||||
|
|
|
|||
|
|
@ -29,3 +29,4 @@ urlpatterns = [
|
|||
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
urlpatterns += static('/ftp', document_root=settings.MEDIA_ROOT)
|
||||
|
|
|
|||
Loading…
Reference in New Issue