From 3be9578ec3b96511188dec99a1ada0145216f54a Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Mon, 13 May 2024 23:10:22 +0200 Subject: [PATCH 1/3] Novinky split It's everything, everything at once. --- deploy_v2/admin_org_prava.json | 8 ++-- mamweb/settings_common.py | 1 + novinky/__init__.py | 0 novinky/admin.py | 3 ++ novinky/apps.py | 5 +++ novinky/migrations/0001_initial.py | 45 +++++++++++++++++++ novinky/migrations/0002_manage_novinky.py | 18 ++++++++ novinky/migrations/0003_novinky_post.py | 13 ++++++ novinky/migrations/__init__.py | 0 .../models/novinky.py => novinky/models.py | 1 + novinky/tests.py | 3 ++ novinky/views.py | 3 ++ personalni/migrations/0007_novinky_pre.py | 13 ++++++ personalni/migrations/0008_novinky_post.py | 14 ++++++ seminar/migrations/0126_novinky_pre.py | 14 ++++++ seminar/migrations/0127_unmanage_novinky.py | 17 +++++++ seminar/migrations/0128_delete_novinky.py | 17 +++++++ seminar/migrations/0129_novinky_post.py | 14 ++++++ seminar/models/__init__.py | 2 +- 19 files changed, 186 insertions(+), 5 deletions(-) create mode 100644 novinky/__init__.py create mode 100644 novinky/admin.py create mode 100644 novinky/apps.py create mode 100644 novinky/migrations/0001_initial.py create mode 100644 novinky/migrations/0002_manage_novinky.py create mode 100644 novinky/migrations/0003_novinky_post.py create mode 100644 novinky/migrations/__init__.py rename seminar/models/novinky.py => novinky/models.py (97%) create mode 100644 novinky/tests.py create mode 100644 novinky/views.py create mode 100644 personalni/migrations/0007_novinky_pre.py create mode 100644 personalni/migrations/0008_novinky_post.py create mode 100644 seminar/migrations/0126_novinky_pre.py create mode 100644 seminar/migrations/0127_unmanage_novinky.py create mode 100644 seminar/migrations/0128_delete_novinky.py create mode 100644 seminar/migrations/0129_novinky_post.py diff --git a/deploy_v2/admin_org_prava.json b/deploy_v2/admin_org_prava.json index 9caa6eb2..370aec4f 100644 --- a/deploy_v2/admin_org_prava.json +++ b/deploy_v2/admin_org_prava.json @@ -331,22 +331,22 @@ }, { "codename": "add_novinky", - "ct_app_label": "seminar", + "ct_app_label": "novinky", "ct_model": "novinky" }, { "codename": "change_novinky", - "ct_app_label": "seminar", + "ct_app_label": "novinky", "ct_model": "novinky" }, { "codename": "delete_novinky", - "ct_app_label": "seminar", + "ct_app_label": "novinky", "ct_model": "novinky" }, { "codename": "view_novinky", - "ct_app_label": "seminar", + "ct_app_label": "novinky", "ct_model": "novinky" }, { diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index d5b35281..92124364 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -149,6 +149,7 @@ INSTALLED_APPS = ( 'treenode', 'vyroci', 'sifrovacka', + 'novinky', # Admin upravy: diff --git a/novinky/__init__.py b/novinky/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/novinky/admin.py b/novinky/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/novinky/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/novinky/apps.py b/novinky/apps.py new file mode 100644 index 00000000..1b728573 --- /dev/null +++ b/novinky/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + +class NovinkyConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'novinky' diff --git a/novinky/migrations/0001_initial.py b/novinky/migrations/0001_initial.py new file mode 100644 index 00000000..0503402c --- /dev/null +++ b/novinky/migrations/0001_initial.py @@ -0,0 +1,45 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:43 + +from django.db import migrations, models + +def nastav_nove_contenttypes(apps, schema_editor): + ContentType = apps.get_model('contenttypes', 'ContentType') + for m in ('novinka'): + oct = ContentType.objects.filter(app_label='seminar', model=m) + oct.update(app_label='novinky') + +def nastav_stare_contenttypes(apps, schema_editor): + ContentType = apps.get_model('contenttypes', 'ContentType') + for m in ('novinka'): + nct = ContentType.objects.filter(app_label='novinky', model=m) + nct.update(app_label='seminar') + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('seminar', '0127_unmanage_novinky'), + ] + + operations = [ + migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes), + migrations.CreateModel( + name='Novinky', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('datum', models.DateField(auto_now_add=True)), + ('text', models.TextField(blank=True, null=True, verbose_name='Text novinky')), + ('obrazek', models.ImageField(blank=True, null=True, upload_to='image_novinky/%Y/%m/%d/', verbose_name='Obrázek')), + ('autor', models.ForeignKey(to='personalni.organizator', verbose_name='Autor novinky', null=True, on_delete=models.SET_NULL)), + ('zverejneno', models.BooleanField(default=False, verbose_name='Zveřejněno')), + ], + options={ + 'verbose_name': 'Novinka', + 'verbose_name_plural': 'Novinky', + 'db_table': 'seminar_novinky', + 'ordering': ['-datum'], + 'managed': False, + }, + ), + ] diff --git a/novinky/migrations/0002_manage_novinky.py b/novinky/migrations/0002_manage_novinky.py new file mode 100644 index 00000000..6c69fe6e --- /dev/null +++ b/novinky/migrations/0002_manage_novinky.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:58 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('novinky', '0001_initial'), + ('seminar', '0128_delete_novinky'), + ] + + operations = [ + migrations.AlterModelOptions( + name='novinky', + options={'ordering': ['-datum'], 'verbose_name': 'Novinka', 'verbose_name_plural': 'Novinky'}, + ), + ] diff --git a/novinky/migrations/0003_novinky_post.py b/novinky/migrations/0003_novinky_post.py new file mode 100644 index 00000000..63cef737 --- /dev/null +++ b/novinky/migrations/0003_novinky_post.py @@ -0,0 +1,13 @@ +# Generated by Django 4.2.13 on 2024-05-13 21:00 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('novinky', '0002_manage_novinky'), + ] + + operations = [ + ] diff --git a/novinky/migrations/__init__.py b/novinky/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/seminar/models/novinky.py b/novinky/models.py similarity index 97% rename from seminar/models/novinky.py rename to novinky/models.py index b67bdfe6..b08faacb 100644 --- a/seminar/models/novinky.py +++ b/novinky/models.py @@ -13,6 +13,7 @@ class Novinky(models.Model): verbose_name = 'Novinka' verbose_name_plural = 'Novinky' ordering = ['-datum'] + db_table = 'seminar_novinky' datum = models.DateField(auto_now_add=True) diff --git a/novinky/tests.py b/novinky/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/novinky/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/novinky/views.py b/novinky/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/novinky/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/personalni/migrations/0007_novinky_pre.py b/personalni/migrations/0007_novinky_pre.py new file mode 100644 index 00000000..c04d481e --- /dev/null +++ b/personalni/migrations/0007_novinky_pre.py @@ -0,0 +1,13 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:35 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('personalni', '0006_pre_split_soustredeni'), + ] + + operations = [ + ] diff --git a/personalni/migrations/0008_novinky_post.py b/personalni/migrations/0008_novinky_post.py new file mode 100644 index 00000000..9d30e7cf --- /dev/null +++ b/personalni/migrations/0008_novinky_post.py @@ -0,0 +1,14 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:59 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('personalni', '0007_novinky_pre'), + ('novinky', '0003_novinky_post'), + ] + + operations = [ + ] diff --git a/seminar/migrations/0126_novinky_pre.py b/seminar/migrations/0126_novinky_pre.py new file mode 100644 index 00000000..1729d176 --- /dev/null +++ b/seminar/migrations/0126_novinky_pre.py @@ -0,0 +1,14 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:36 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0125_post_split_soustredeni'), + ('personalni', '0007_novinky_pre'), + ] + + operations = [ + ] diff --git a/seminar/migrations/0127_unmanage_novinky.py b/seminar/migrations/0127_unmanage_novinky.py new file mode 100644 index 00000000..afca5443 --- /dev/null +++ b/seminar/migrations/0127_unmanage_novinky.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:41 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0126_novinky_pre'), + ] + + operations = [ + migrations.AlterModelOptions( + name='novinky', + options={'managed': False, 'ordering': ['-datum'], 'verbose_name': 'Novinka', 'verbose_name_plural': 'Novinky'}, + ), + ] diff --git a/seminar/migrations/0128_delete_novinky.py b/seminar/migrations/0128_delete_novinky.py new file mode 100644 index 00000000..9708a09a --- /dev/null +++ b/seminar/migrations/0128_delete_novinky.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:54 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0127_unmanage_novinky'), + ('novinky', '0001_initial'), + ] + + operations = [ + migrations.DeleteModel( + name='Novinky', + ), + ] diff --git a/seminar/migrations/0129_novinky_post.py b/seminar/migrations/0129_novinky_post.py new file mode 100644 index 00000000..11b2b587 --- /dev/null +++ b/seminar/migrations/0129_novinky_post.py @@ -0,0 +1,14 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:59 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0128_delete_novinky'), + ('novinky', '0003_novinky_post'), + ] + + operations = [ + ] diff --git a/seminar/models/__init__.py b/seminar/models/__init__.py index 121aeb04..e404864a 100644 --- a/seminar/models/__init__.py +++ b/seminar/models/__init__.py @@ -3,11 +3,11 @@ from .odevzdavatko import * from .base import * from .pomocne import * from .treenode import * -from .novinky import * from various.models import Nastaveni from personalni.models import Organizator, Resitel, Skola, Prijemce, Osoba from soustredeni.models import Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Konfera, Konfery_Ucastnici +from novinky.models import Novinky # Kvůli migr. 0041 from soustredeni.models import generate_filename_konfera From 7e6dd72722a75205e1164e7c472dea9a706be9b6 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Mon, 13 May 2024 23:13:51 +0200 Subject: [PATCH 2/3] =?UTF-8?q?P=C5=99esunut=C3=AD=20admina=20pro=20novink?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- novinky/admin.py | 4 +++- seminar/admin.py | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/novinky/admin.py b/novinky/admin.py index 8c38f3f3..ea822bca 100644 --- a/novinky/admin.py +++ b/novinky/admin.py @@ -1,3 +1,5 @@ from django.contrib import admin -# Register your models here. +from .models import Novinky + +admin.site.register(Novinky) diff --git a/seminar/admin.py b/seminar/admin.py index 8f589a03..deaba97f 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -186,4 +186,3 @@ class ResitelInline(admin.TabularInline): # admin.site.register(m.Pohadka) admin.site.register(m.Obrazek) admin.site.register(m.Nastaveni, SingletonModelAdmin) -admin.site.register(m.Novinky) From 607129a8995a1265494f97012563543da282928e Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Mon, 13 May 2024 23:45:47 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=C3=9Aprava=20orgorozcestn=C3=ADku?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- personalni/templates/personalni/profil/orgorozcestnik.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/personalni/templates/personalni/profil/orgorozcestnik.html b/personalni/templates/personalni/profil/orgorozcestnik.html index 46a26826..90d5867d 100644 --- a/personalni/templates/personalni/profil/orgorozcestnik.html +++ b/personalni/templates/personalni/profil/orgorozcestnik.html @@ -13,7 +13,7 @@
  • soustředění
  • -
  • přidat novinku na web
  • +
  • přidat novinku na web