Browse Source

Změna všeho

uzfunguj
Patolán 5 years ago
parent
commit
582e5fbb08
  1. 53
      blog/settings/base.py
  2. 2
      blog/settings/dev.py
  3. 2
      blog/wsgi.py
  4. 2
      home/migrations/0003_homepage_body.py
  5. 1
      home/models.py
  6. 3
      home/templates/home/home_page.html
  7. 0
      zapisnik/__init__.py
  8. 3
      zapisnik/admin.py
  9. 5
      zapisnik/apps.py
  10. 28
      zapisnik/migrations/0001_initial.py
  11. 29
      zapisnik/migrations/0002_blogpage.py
  12. 0
      zapisnik/migrations/__init__.py
  13. 33
      zapisnik/models.py
  14. 18
      zapisnik/templates/zapisnik/blog_index_page.html
  15. 17
      zapisnik/templates/zapisnik/blog_page.html
  16. 3
      zapisnik/tests.py
  17. 3
      zapisnik/views.py

53
blog/settings/base.py

@ -1,13 +1,13 @@
"""
Django settings for blog project.
Generated by 'django-admin startproject' using Django 3.0.6.
Generated by 'django-admin startproject' using Django 3.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
@ -18,7 +18,7 @@ BASE_DIR = os.path.dirname(PROJECT_DIR)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# Application definition
@ -48,6 +48,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'zapisnik',
]
MIDDLEWARE = [
@ -86,7 +87,7 @@ WSGI_APPLICATION = 'blog.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
@ -97,30 +98,30 @@ DATABASES = {
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
# AUTH_PASSWORD_VALIDATORS = [
# {
# 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
# },
# {
# 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
# },
# {
# 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
# },
# {
# 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
# },
# ]
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'cs'
TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Prague'
USE_I18N = True
@ -130,7 +131,7 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
@ -143,7 +144,7 @@ STATICFILES_DIRS = [
# ManifestStaticFilesStorage is recommended in production, to prevent outdated
# Javascript / CSS assets being served from cache (e.g. after a Wagtail upgrade).
# See https://docs.djangoproject.com/en/3.0/ref/contrib/staticfiles/#manifeststaticfilesstorage
# See https://docs.djangoproject.com/en/3.1/ref/contrib/staticfiles/#manifeststaticfilesstorage
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

2
blog/settings/dev.py

@ -4,7 +4,7 @@ from .base import *
DEBUG = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'ur3l)t4xar!mnifbr=*g4ui4m!z=f9upzxg72xowc*#)_ksd$k'
SECRET_KEY = '2p*omsz*++h9ck1)shb9^vzi1u#lay&@j-wl^#f=%_4cf6v7ii'
# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ['*']

2
blog/wsgi.py

@ -4,7 +4,7 @@ WSGI config for blog project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os

2
home/migrations/0003_homepage_body.py

@ -1,4 +1,4 @@
# Generated by Django 3.0.6 on 2020-10-16 09:17
# Generated by Django 3.1.2 on 2020-10-16 09:16
from django.db import migrations
import wagtail.core.fields

1
home/models.py

@ -4,6 +4,7 @@ from wagtail.core.models import Page
from wagtail.core.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel
class HomePage(Page):
body = RichTextField(blank=True)

3
home/templates/home/home_page.html

@ -1,5 +1,4 @@
{% extends "base.html" %}
{% load static %}
{% load wagtailcore_tags %}
{% block body_class %}template-homepage{% endblock %}
@ -9,7 +8,7 @@
{% endblock extra_css %}
{% block content %}
tomáš patolán
{{ page.body|richtext }}
{% endblock content %}

0
zapisnik/__init__.py

3
zapisnik/admin.py

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
zapisnik/apps.py

@ -0,0 +1,5 @@
from django.apps import AppConfig
class ZapisnikConfig(AppConfig):
name = 'zapisnik'

28
zapisnik/migrations/0001_initial.py

@ -0,0 +1,28 @@
# Generated by Django 3.1.2 on 2020-10-21 08:42
from django.db import migrations, models
import django.db.models.deletion
import wagtail.core.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore', '0052_pagelogentry'),
]
operations = [
migrations.CreateModel(
name='BlogIndexPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('intro', wagtail.core.fields.RichTextField(blank=True)),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
]

29
zapisnik/migrations/0002_blogpage.py

@ -0,0 +1,29 @@
# Generated by Django 3.1.2 on 2020-10-21 09:04
from django.db import migrations, models
import django.db.models.deletion
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0052_pagelogentry'),
('zapisnik', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='BlogPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('date', models.DateField(verbose_name='Post date')),
('intro', models.CharField(max_length=250)),
('body', wagtail.core.fields.RichTextField(blank=True)),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
]

0
zapisnik/migrations/__init__.py

33
zapisnik/models.py

@ -0,0 +1,33 @@
from django.db import models
# Create your models here.
from wagtail.core.models import Page
from wagtail.core.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.search import index
class BlogIndexPage(Page):
intro = RichTextField(blank=True)
content_panels = Page.content_panels + [
FieldPanel('intro', classname="full")
]
class BlogPage(Page):
date = models.DateField("Post date")
intro = models.CharField(max_length=250)
body = RichTextField(blank=True)
search_fields = Page.search_fields + [
index.SearchField('intro'),
index.SearchField('body'),
]
content_panels = Page.content_panels + [
FieldPanel('date'),
FieldPanel('intro'),
FieldPanel('body', classname="full"),
]

18
zapisnik/templates/zapisnik/blog_index_page.html

@ -0,0 +1,18 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% block body_class %}template-blogindexpage{% endblock %}
{% block content %}
<h1>{{ page.title }}</h1>
<div class="intro">{{ page.intro|richtext }}</div>
{% for post in page.get_children %}
<h2><a href="{% pageurl post %}">{{ post.title }}</a></h2>
{{ post.specific.intro }}
{# {{ post.specific.body|richtext }} #}
{% endfor %}
{% endblock %}

17
zapisnik/templates/zapisnik/blog_page.html

@ -0,0 +1,17 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% block body_class %}template-blogpage{% endblock %}
{% block content %}
<h1>{{ page.title }}</h1>
<p class="meta">{{ page.date }}</p>
<div class="intro">{{ page.intro }}</div>
{{ page.body|richtext }}
<p><a href="{{ page.get_parent.url }}">Return to blog</a></p>
{% endblock %}

3
zapisnik/tests.py

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
zapisnik/views.py

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.
Loading…
Cancel
Save