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..ea822bca --- /dev/null +++ b/novinky/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from .models import Novinky + +admin.site.register(Novinky) 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/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 @@