Move header_fotky do vlastní aplikace
This commit is contained in:
parent
5065d75cc0
commit
09896fbb96
10 changed files with 46 additions and 34 deletions
|
@ -1,6 +1,6 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "baliky.jpg",
|
"pk": "baliky.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "beh.jpg",
|
"pk": "beh.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "kryptografie.jpg",
|
"pk": "kryptografie.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "mam_cernobile.jpg",
|
"pk": "mam_cernobile.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "noc.jpg",
|
"pk": "noc.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "ohen.jpg",
|
"pk": "ohen.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "snih.jpg",
|
"pk": "snih.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "spolecna.jpg",
|
"pk": "spolecna.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "stiny.jpg",
|
"pk": "stiny.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "vikendovka.jpg",
|
"pk": "vikendovka.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaheader",
|
"model": "header_fotky.fotkaheader",
|
||||||
"pk": "vylet.jpg",
|
"pk": "vylet.jpg",
|
||||||
"fields": {
|
"fields": {
|
||||||
"cas": "2020-09-20T09:18:34.562Z",
|
"cas": "2020-09-20T09:18:34.562Z",
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 1,
|
"pk": 1,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/archiv/",
|
"url": "/archiv/",
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 2,
|
"pk": 2,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/clanky/",
|
"url": "/clanky/",
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 3,
|
"pk": 3,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/clanky/",
|
"url": "/clanky/",
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 4,
|
"pk": 4,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/zadani/",
|
"url": "/zadani/",
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 5,
|
"pk": 5,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/zadani/",
|
"url": "/zadani/",
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 6,
|
"pk": 6,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/co-je-MaM/",
|
"url": "/co-je-MaM/",
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 7,
|
"pk": 7,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/co-je-MaM/",
|
"url": "/co-je-MaM/",
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 8,
|
"pk": 8,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/soustredeni/",
|
"url": "/soustredeni/",
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 9,
|
"pk": 9,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/soustredeni/",
|
"url": "/soustredeni/",
|
||||||
|
@ -169,7 +169,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 10,
|
"pk": 10,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/login/",
|
"url": "/login/",
|
||||||
|
@ -178,7 +178,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 11,
|
"pk": 11,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/login/",
|
"url": "/login/",
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 12,
|
"pk": 12,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/profil/",
|
"url": "/profil/",
|
||||||
|
@ -196,7 +196,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "mamweb.fotkaurlvazba",
|
"model": "header_fotky.fotkaurlvazba",
|
||||||
"pk": 13,
|
"pk": 13,
|
||||||
"fields": {
|
"fields": {
|
||||||
"url": "/profil/",
|
"url": "/profil/",
|
||||||
|
|
10
header_fotky/admin.py
Normal file
10
header_fotky/admin.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.contrib.admin import ModelAdmin
|
||||||
|
import header_fotky.models as m
|
||||||
|
|
||||||
|
|
||||||
|
class FotkaPozadiAdmin(ModelAdmin):
|
||||||
|
readonly_fields = ['cas']
|
||||||
|
|
||||||
|
admin.site.register(m.FotkaHeader, FotkaPozadiAdmin)
|
||||||
|
admin.site.register(m.FotkaUrlVazba)
|
5
header_fotky/apps.py
Normal file
5
header_fotky/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class HeaderFotkyConfig(AppConfig):
|
||||||
|
name = 'header_fotky'
|
|
@ -8,7 +8,10 @@ from shutil import copytree
|
||||||
|
|
||||||
|
|
||||||
def zkopiruj_fotky(apps, schema_editor):
|
def zkopiruj_fotky(apps, schema_editor):
|
||||||
copytree("mamweb/static/images/header/", "media/header/") # FIXME: bylo tu dirs_exists_ok=True, nekompatibilní s Py 3.7
|
try:
|
||||||
|
copytree("mamweb/static/images/header/", "media/header/") # FIXME: bylo tu dirs_exists_ok=True, nekompatibilní s Py 3.7
|
||||||
|
except FileExistsError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
@ -45,7 +48,7 @@ class Migration(migrations.Migration):
|
||||||
('denni_doba', models.CharField(choices=[('den', 'Zobrazit jen ve dne'), ('noc', 'Zobrazit jen v noci'),
|
('denni_doba', models.CharField(choices=[('den', 'Zobrazit jen ve dne'), ('noc', 'Zobrazit jen v noci'),
|
||||||
('oboji', 'Zobrazovat pořád')], default='oboji', max_length=16,
|
('oboji', 'Zobrazovat pořád')], default='oboji', max_length=16,
|
||||||
verbose_name='denní doba')),
|
verbose_name='denní doba')),
|
||||||
('fotka', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mamweb.FotkaHeader',
|
('fotka', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='header_fotky.FotkaHeader',
|
||||||
verbose_name='fotka')),
|
verbose_name='fotka')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
0
header_fotky/migrations/__init__.py
Normal file
0
header_fotky/migrations/__init__.py
Normal file
|
@ -1,5 +1,4 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.admin import ModelAdmin
|
|
||||||
from django.contrib.flatpages.models import FlatPage
|
from django.contrib.flatpages.models import FlatPage
|
||||||
|
|
||||||
# Note: we are renaming the original Admin and Form as we import them!
|
# Note: we are renaming the original Admin and Form as we import them!
|
||||||
|
@ -9,7 +8,6 @@ from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
|
||||||
from django import forms
|
from django import forms
|
||||||
from ckeditor_uploader.widgets import CKEditorUploadingWidget
|
from ckeditor_uploader.widgets import CKEditorUploadingWidget
|
||||||
|
|
||||||
import mamweb.models as m
|
|
||||||
|
|
||||||
class FlatpageForm(FlatpageFormOld):
|
class FlatpageForm(FlatpageFormOld):
|
||||||
content = forms.CharField(widget=CKEditorUploadingWidget())
|
content = forms.CharField(widget=CKEditorUploadingWidget())
|
||||||
|
@ -26,8 +24,3 @@ class FlatPageAdmin(FlatPageAdminOld):
|
||||||
admin.site.unregister(FlatPage)
|
admin.site.unregister(FlatPage)
|
||||||
admin.site.register(FlatPage, FlatPageAdmin)
|
admin.site.register(FlatPage, FlatPageAdmin)
|
||||||
|
|
||||||
class FotkaPozadiAdmin(ModelAdmin):
|
|
||||||
readonly_fields = ['cas']
|
|
||||||
|
|
||||||
admin.site.register(m.FotkaHeader, FotkaPozadiAdmin)
|
|
||||||
admin.site.register(m.FotkaUrlVazba)
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import random
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from mamweb.models import FotkaUrlVazba
|
from header_fotky.models import FotkaUrlVazba
|
||||||
|
|
||||||
|
|
||||||
def vzhled(request):
|
def vzhled(request):
|
||||||
|
|
|
@ -127,6 +127,7 @@ INSTALLED_APPS = (
|
||||||
'galerie',
|
'galerie',
|
||||||
'korektury',
|
'korektury',
|
||||||
'prednasky',
|
'prednasky',
|
||||||
|
'header_fotky',
|
||||||
|
|
||||||
# Admin upravy:
|
# Admin upravy:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue