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",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -8,7 +8,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "beh.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -16,7 +16,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "kryptografie.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -24,7 +24,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "mam_cernobile.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "noc.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -40,7 +40,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "ohen.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "snih.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "spolecna.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -64,7 +64,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "stiny.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -72,7 +72,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "vikendovka.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -80,7 +80,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaheader",
|
||||
"model": "header_fotky.fotkaheader",
|
||||
"pk": "vylet.jpg",
|
||||
"fields": {
|
||||
"cas": "2020-09-20T09:18:34.562Z",
|
||||
|
@ -88,7 +88,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 1,
|
||||
"fields": {
|
||||
"url": "/archiv/",
|
||||
|
@ -97,7 +97,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 2,
|
||||
"fields": {
|
||||
"url": "/clanky/",
|
||||
|
@ -106,7 +106,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 3,
|
||||
"fields": {
|
||||
"url": "/clanky/",
|
||||
|
@ -115,7 +115,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 4,
|
||||
"fields": {
|
||||
"url": "/zadani/",
|
||||
|
@ -124,7 +124,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 5,
|
||||
"fields": {
|
||||
"url": "/zadani/",
|
||||
|
@ -133,7 +133,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 6,
|
||||
"fields": {
|
||||
"url": "/co-je-MaM/",
|
||||
|
@ -142,7 +142,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 7,
|
||||
"fields": {
|
||||
"url": "/co-je-MaM/",
|
||||
|
@ -151,7 +151,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 8,
|
||||
"fields": {
|
||||
"url": "/soustredeni/",
|
||||
|
@ -160,7 +160,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 9,
|
||||
"fields": {
|
||||
"url": "/soustredeni/",
|
||||
|
@ -169,7 +169,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 10,
|
||||
"fields": {
|
||||
"url": "/login/",
|
||||
|
@ -178,7 +178,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 11,
|
||||
"fields": {
|
||||
"url": "/login/",
|
||||
|
@ -187,7 +187,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 12,
|
||||
"fields": {
|
||||
"url": "/profil/",
|
||||
|
@ -196,7 +196,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"model": "mamweb.fotkaurlvazba",
|
||||
"model": "header_fotky.fotkaurlvazba",
|
||||
"pk": 13,
|
||||
"fields": {
|
||||
"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):
|
||||
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):
|
||||
|
@ -45,7 +48,7 @@ class Migration(migrations.Migration):
|
|||
('denni_doba', models.CharField(choices=[('den', 'Zobrazit jen ve dne'), ('noc', 'Zobrazit jen v noci'),
|
||||
('oboji', 'Zobrazovat pořád')], default='oboji', max_length=16,
|
||||
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')),
|
||||
],
|
||||
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.admin import ModelAdmin
|
||||
from django.contrib.flatpages.models import FlatPage
|
||||
|
||||
# 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 ckeditor_uploader.widgets import CKEditorUploadingWidget
|
||||
|
||||
import mamweb.models as m
|
||||
|
||||
class FlatpageForm(FlatpageFormOld):
|
||||
content = forms.CharField(widget=CKEditorUploadingWidget())
|
||||
|
@ -26,8 +24,3 @@ class FlatPageAdmin(FlatPageAdminOld):
|
|||
admin.site.unregister(FlatPage)
|
||||
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 mamweb.models import FotkaUrlVazba
|
||||
from header_fotky.models import FotkaUrlVazba
|
||||
|
||||
|
||||
def vzhled(request):
|
||||
|
|
|
@ -127,6 +127,7 @@ INSTALLED_APPS = (
|
|||
'galerie',
|
||||
'korektury',
|
||||
'prednasky',
|
||||
'header_fotky',
|
||||
|
||||
# Admin upravy:
|
||||
|
||||
|
|
Loading…
Reference in a new issue