Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.8 KiB
46 lines
1.8 KiB
8 months ago
|
# 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,
|
||
|
},
|
||
|
),
|
||
|
]
|