diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..63ce98d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,39 @@ +# Django project +/media/ +/static/ +*.sqlite3 + +# Python and others +__pycache__ +*.pyc +.DS_Store +*.swp +/venv/ +/tmp/ +/.vagrant/ +/Vagrantfile.local +node_modules/ +/npm-debug.log +/.idea/ +.vscode +coverage +.python-version + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e224c61 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +# Use an official Python runtime based on Debian 10 "buster" as a parent image. +FROM python:3.8.1-slim-buster + +# Add user that will be used in the container. +RUN useradd wagtail + +# Port used by this container to serve HTTP. +EXPOSE 8000 + +# Set environment variables. +# 1. Force Python stdout and stderr streams to be unbuffered. +# 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE" +# command. +ENV PYTHONUNBUFFERED=1 \ + PORT=8000 + +# Install system packages required by Wagtail and Django. +RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \ + build-essential \ + libpq-dev \ + libmariadbclient-dev \ + libjpeg62-turbo-dev \ + zlib1g-dev \ + libwebp-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install the application server. +RUN pip install "gunicorn==20.0.4" + +# Install the project requirements. +COPY requirements.txt / +RUN pip install -r /requirements.txt + +# Use /app folder as a directory where the source code is stored. +WORKDIR /app + +# Set this directory to be owned by the "wagtail" user. This Wagtail project +# uses SQLite, the folder needs to be owned by the user that +# will be writing to the database file. +RUN chown wagtail:wagtail /app + +# Copy the source code of the project into the container. +COPY --chown=wagtail:wagtail . . + +# Use user "wagtail" to run the build commands below and the server itself. +USER wagtail + +# Collect static files. +RUN python manage.py collectstatic --noinput --clear + +# Runtime command that executes when "docker run" is called, it does the +# following: +# 1. Migrate the database. +# 2. Start the application server. +# WARNING: +# Migrating database at the same time as starting the server IS NOT THE BEST +# PRACTICE. The database should be migrated manually or using the release +# phase facilities of your hosting platform. This is used only so the +# Wagtail instance can be started with a simple "docker run" command. +CMD set -xe; python manage.py migrate --noinput; gunicorn veterinahelcl.wsgi:application diff --git a/diskuze/__init__.py b/diskuze/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/diskuze/admin.py b/diskuze/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/diskuze/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/diskuze/apps.py b/diskuze/apps.py new file mode 100644 index 0000000..8bbd493 --- /dev/null +++ b/diskuze/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class DiskuzeConfig(AppConfig): + name = 'diskuze' diff --git a/diskuze/migrations/0001_initial.py b/diskuze/migrations/0001_initial.py new file mode 100644 index 0000000..5560ede --- /dev/null +++ b/diskuze/migrations/0001_initial.py @@ -0,0 +1,57 @@ +# Generated by Django 3.1.3 on 2020-11-24 12:49 + +from django.db import migrations, models +import django.db.models.deletion +import modelcluster.fields +import wagtail.core.fields + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('wagtailcore', '0059_apply_collection_ordering'), + ('wagtailimages', '0022_uploadedimage'), + ] + + 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',), + ), + 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',), + ), + migrations.CreateModel( + name='BlogPageGalleryImage', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('caption', models.CharField(blank=True, max_length=250)), + ('image', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailimages.image')), + ('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='gallery_images', to='diskuze.blogpage')), + ], + options={ + 'ordering': ['sort_order'], + 'abstract': False, + }, + ), + ] diff --git a/diskuze/migrations/__init__.py b/diskuze/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/diskuze/models.py b/diskuze/models.py new file mode 100644 index 0000000..547168f --- /dev/null +++ b/diskuze/models.py @@ -0,0 +1,55 @@ +from django.db import models + +from modelcluster.fields import ParentalKey + +from wagtail.core.models import Page, Orderable +from wagtail.core.fields import RichTextField +from wagtail.admin.edit_handlers import FieldPanel, InlinePanel +from wagtail.images.edit_handlers import ImageChooserPanel +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) + + def main_image(self): + gallery_item = self.gallery_images.first() + if gallery_item: + return gallery_item.image + else: + return None + + search_fields = Page.search_fields + [ + index.SearchField('intro'), + index.SearchField('body'), + ] + + content_panels = Page.content_panels + [ + FieldPanel('date'), + FieldPanel('intro'), + FieldPanel('body', classname="full"), + InlinePanel('gallery_images', label="Obrázky"), + ] + + +class BlogPageGalleryImage(Orderable): + page = ParentalKey(BlogPage, on_delete=models.CASCADE, related_name='gallery_images') + image = models.ForeignKey( + 'wagtailimages.Image', on_delete=models.CASCADE, related_name='+' + ) + caption = models.CharField(blank=True, max_length=250) + + panels = [ + ImageChooserPanel('image'), + FieldPanel('caption'), + ] \ No newline at end of file diff --git a/diskuze/templates/diskuze/blog_page.html b/diskuze/templates/diskuze/blog_page.html new file mode 100644 index 0000000..bd8d4bc --- /dev/null +++ b/diskuze/templates/diskuze/blog_page.html @@ -0,0 +1,185 @@ +{% extends "base.html" %} + {% load static %} + {% block body_class %}template-homepage{% endblock %} + {% block extra_css %} + {% comment %} Delete the line below if you're just getting started and want to remove the welcome screen! {% endcomment %} + + {% endblock extra_css %} + {% block content %} + {% comment %} Delete the line below if you're just getting started and want to remove the welcome screen! {% endcomment %} +
+ +

Diskuze

+
+
+
+
+

Jméno

+
+
+
+
+
+
+ +
+ Stouto klinikou jsem velmi spokojen. Milé prostředí pěkná atmosféra i pro Rexe. +
+
+
+ +
+ 11.5.2020 - 16.5.2020 +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+
+

Jméno

+
+
+
+
+
+
+ +
+ Stouto klinikou jsem velmi spokojen. Milé prostředí pěkná atmosféra i pro Rexe. +
+
+
+ +
+ 11.5.2020 - 16.5.2020 +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+
+

Jméno

+
+
+
+
+
+
+ +
+ Stouto klinikou jsem velmi spokojen. Milé prostředí pěkná atmosféra i pro Rexe. +
+
+
+ +
+ 11.5.2020 - 16.5.2020 +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+
+

Jméno

+
+
+
+
+
+
+ +
+ Stouto klinikou jsem velmi spokojen. Milé prostředí pěkná atmosféra i pro Rexe. +
+
+
+ +
+ 11.5.2020 - 16.5.2020 +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+
+

Jméno

+
+
+
+
+
+
+ +
+ Stouto klinikou jsem velmi spokojen. Milé prostředí pěkná atmosféra i pro Rexe. +
+
+
+ +
+ 11.5.2020 - 16.5.2020 +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+{% endblock content %} \ No newline at end of file diff --git a/diskuze/tests.py b/diskuze/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/diskuze/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/diskuze/views.py b/diskuze/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/diskuze/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/home/__init__.py b/home/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/home/migrations/0001_initial.py b/home/migrations/0001_initial.py new file mode 100644 index 0000000..ef46d12 --- /dev/null +++ b/home/migrations/0001_initial.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0040_page_draft_title'), + ] + + operations = [ + migrations.CreateModel( + name='HomePage', + fields=[ + ('page_ptr', models.OneToOneField(on_delete=models.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + ] diff --git a/home/migrations/0002_create_homepage.py b/home/migrations/0002_create_homepage.py new file mode 100644 index 0000000..039f0f5 --- /dev/null +++ b/home/migrations/0002_create_homepage.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +from django.db import migrations + + +def create_homepage(apps, schema_editor): + # Get models + ContentType = apps.get_model('contenttypes.ContentType') + Page = apps.get_model('wagtailcore.Page') + Site = apps.get_model('wagtailcore.Site') + HomePage = apps.get_model('home.HomePage') + + # Delete the default homepage + # If migration is run multiple times, it may have already been deleted + Page.objects.filter(id=2).delete() + + # Create content type for homepage model + homepage_content_type, __ = ContentType.objects.get_or_create( + model='homepage', app_label='home') + + # Create a new homepage + homepage = HomePage.objects.create( + title="Home", + draft_title="Home", + slug='home', + content_type=homepage_content_type, + path='00010001', + depth=2, + numchild=0, + url_path='/home/', + ) + + # Create a site with the new homepage set as the root + Site.objects.create( + hostname='localhost', root_page=homepage, is_default_site=True) + + +def remove_homepage(apps, schema_editor): + # Get models + ContentType = apps.get_model('contenttypes.ContentType') + HomePage = apps.get_model('home.HomePage') + + # Delete the default homepage + # Page and Site objects CASCADE + HomePage.objects.filter(slug='home', depth=2).delete() + + # Delete content type for homepage model + ContentType.objects.filter(model='homepage', app_label='home').delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0001_initial'), + ] + + operations = [ + migrations.RunPython(create_homepage, remove_homepage), + ] diff --git a/home/migrations/0003_homepage_body.py b/home/migrations/0003_homepage_body.py new file mode 100644 index 0000000..8aefbae --- /dev/null +++ b/home/migrations/0003_homepage_body.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.3 on 2020-11-24 13:04 + +from django.db import migrations +import wagtail.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0002_create_homepage'), + ] + + operations = [ + migrations.AddField( + model_name='homepage', + name='body', + field=wagtail.core.fields.RichTextField(blank=True), + ), + ] diff --git a/home/migrations/0004_auto_20201124_1559.py b/home/migrations/0004_auto_20201124_1559.py new file mode 100644 index 0000000..8d2660e --- /dev/null +++ b/home/migrations/0004_auto_20201124_1559.py @@ -0,0 +1,26 @@ +# Generated by Django 3.1.3 on 2020-11-24 14:59 + +from django.db import migrations, models +import django.db.models.deletion +import wagtail.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailimages', '0022_uploadedimage'), + ('home', '0003_homepage_body'), + ] + + operations = [ + migrations.AddField( + model_name='homepage', + name='address', + field=wagtail.core.fields.RichTextField(blank=True), + ), + migrations.AddField( + model_name='homepage', + name='image', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailimages.image'), + ), + ] diff --git a/home/migrations/__init__.py b/home/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/home/models.py b/home/models.py new file mode 100644 index 0000000..67a4a8e --- /dev/null +++ b/home/models.py @@ -0,0 +1,22 @@ +from django.db import models + +from modelcluster.fields import ParentalKey + +from wagtail.core.models import Page, Orderable +from wagtail.core.fields import RichTextField +from wagtail.images.edit_handlers import ImageChooserPanel +from wagtail.admin.edit_handlers import FieldPanel, InlinePanel + + +class HomePage(Page): + body = RichTextField(blank=True) + address = RichTextField(blank=True) + image = models.ForeignKey( + 'wagtailimages.Image', on_delete=models.PROTECT, null=True, related_name='+' + ) + + content_panels = Page.content_panels + [ + FieldPanel('body', classname="full"), + FieldPanel('address', classname="full"), + ImageChooserPanel('image'), + ] \ No newline at end of file diff --git a/home/static/css/style.css b/home/static/css/style.css new file mode 100644 index 0000000..d3fc6f9 --- /dev/null +++ b/home/static/css/style.css @@ -0,0 +1,124 @@ +.df { + display: flex; +} +.jcsb { + justify-content: space-between; +} +.jcc { + justify-content: center; +} +.tac { + text-align: center; +} +body { + background: linear-gradient(180deg, rgb(190 29 45) 0%, rgba(255,250,250,1) 25%); +} +.top-menu { + width: 100%; + background-color: #ffffff; + display: inline-flex; + height: 60px; + border-radius: 5px 5px 5px 5px; + margin-top: 15px; +} +.top-menu .logo{ + width: auto; + margin-right: 0px; + align-self: center; +} +.top-menu .logo img{ + width: 40px; + height: 40px; + margin: 0px 10px; +} +.top-menu ul { + list-style-type: none; + margin: 0; + padding: 0; + overflow: hidden; + align-self: center; +} + +.top-menu li { + float: left; +} + +.top-menu li a { + display: block; + color: #333333; + text-align: center; + padding: 14px 16px; + text-decoration: none; +} + +.top-menu li a:hover { + background-color: #dd87903b; + border-radius: 5px; +} +h3 { + font-size: 20px; + color: #ffffff; + padding: 10px 0px !important; +} +.grid.clasik .grid-title { + font-size: 18px; + background-color: #ffffff; + border-radius: 5px 5px 0px 0px; + justify-content: center; + border: 1px solid #333333; + border-bottom: none; +} +.grid.clasik .grid-title h4 { + padding: 5px 15px; + border-bottom: 1px solid #333333; +} +.grid.clasik .grid-body { + padding: 10px 5px; + font-size: 12px; + background-color: #ffffff; + border-radius: 0px 0px 5px 5px; + margin-bottom: 10px; + border: 1px solid #333333; +} +.grid.clasik .grid-body label { + color: #858585; + font-size: 8px; + line-height: 8px; + margin-bottom: 0px; +} +.grid.clasik { + box-shadow: 0px 0px 30px -5px #dd8790; + border-radius: 5px; +} +.grid.clasik.border { + border: none !important; +} +.grid.clasik.border .grid-body { + border: 1px solid #333333; + border-top: none; +} +.grid.clasik.border .grid-title { + border-bottom: none; +} +.grid.clasik.border .grid-title h4 { + border: 1px solid #333333; + border-top: none; +} +.grid-body.dark { + font-weight: 900; + font-size: 25px !important; +} +.grid-body.all-border { + border-radius: 5px !important; +} +.grid .grid-body .img { + text-align: center; +} +.grid .grid-body .img img { + width: 40%; + height: auto; +} +.table .thead-dark th { + background-color: #dd8790; + border-color: #dd8790; +} \ No newline at end of file diff --git a/home/static/css/welcome_page.css b/home/static/css/welcome_page.css new file mode 100644 index 0000000..ce8b149 --- /dev/null +++ b/home/static/css/welcome_page.css @@ -0,0 +1,204 @@ +html { + box-sizing: border-box; +} + +*, +*:before, +*:after { + box-sizing: inherit; +} + +body { + max-width: 960px; + min-height: 100vh; + margin: 0 auto; + padding: 0 15px; + color: #231f20; + font-family: 'Helvetica Neue', 'Segoe UI', Arial, sans-serif; + line-height: 1.25; +} + +a { + background-color: transparent; + color: #308282; + text-decoration: underline; +} + +a:hover { + color: #ea1b10; +} + +h1, +h2, +h3, +h4, +h5, +p, +ul { + padding: 0; + margin: 0; + font-weight: 400; +} + +main { + display: block; /* For IE11 support */ +} + +svg:not(:root) { + overflow: hidden; +} + +.header { + display: flex; + justify-content: space-between; + align-items: center; + padding-top: 20px; + padding-bottom: 10px; + border-bottom: 1px solid #e6e6e6; +} + +.logo { + width: 150px; + margin-right: 20px; +} + +.logo a { + display: block; +} + +.figure-logo { + max-width: 150px; + max-height: 55.1px; +} + +.release-notes { + font-size: 14px; +} + +.main { + padding: 40px 0; + margin: 0 auto; + text-align: center; +} + +.figure-space { + max-width: 265px; +} + +@-webkit-keyframes pos { + 0%, 100% { + -webkit-transform: rotate(-6deg); + transform: rotate(-6deg); + } + 50% { + -webkit-transform: rotate(6deg); + transform: rotate(6deg); + } +} + +@keyframes pos { + 0%, 100% { + -webkit-transform: rotate(-6deg); + transform: rotate(-6deg); + } + 50% { + -webkit-transform: rotate(6deg); + transform: rotate(6deg); + } +} + +.egg { + fill: #43b1b0; + -webkit-animation: pos 3s ease infinite; + animation: pos 3s ease infinite; + -webkit-transform: translateY(50px); + transform: translateY(50px); + -webkit-transform-origin: 50% 80%; + transform-origin: 50% 80%; +} + +.main-text { + max-width: 400px; + margin: 5px auto; +} + +.main-text h1 { + font-size: 22px; +} + +.main-text p { + margin: 15px auto 0; +} + +.footer { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + border-top: 1px solid #e6e6e6; + padding: 10px; +} + +.option { + display: block; + padding: 10px 10px 10px 34px; + position: relative; + text-decoration: none; +} + +.option svg { + width: 24px; + height: 24px; + fill: gray; + border: 1px solid #d9d9d9; + padding: 5px; + border-radius: 100%; + top: 10px; + left: 0; + position: absolute; +} + +.option h4 { + font-size: 19px; + text-decoration: underline; +} + +.option p { + padding-top: 3px; + color: #231f20; + font-size: 15px; + font-weight: 300; +} + +@media (max-width: 996px) { + body { + max-width: 780px; + } +} + +@media (max-width: 767px) { + .option { + flex: 0 0 50%; + } +} + +@media (max-width: 599px) { + .main { + padding: 20px 0; + } + + .figure-space { + max-width: 200px; + } + + .footer { + display: block; + width: 300px; + margin: 0 auto; + } +} + +@media (max-width: 360px) { + .header-link { + max-width: 100px; + } +} diff --git a/home/static/img/veterina-logo.png b/home/static/img/veterina-logo.png new file mode 100644 index 0000000..fc3db60 Binary files /dev/null and b/home/static/img/veterina-logo.png differ diff --git a/home/templates/home/home_page.html b/home/templates/home/home_page.html new file mode 100644 index 0000000..7c5a0e5 --- /dev/null +++ b/home/templates/home/home_page.html @@ -0,0 +1,104 @@ +{% extends "base.html" %} + {% load static %} + {% block body_class %}template-homepage{% endblock %} + {% block extra_css %} + {% comment %} Delete the line below if you're just getting started and want to remove the welcome screen! {% endcomment %} + + {% endblock extra_css %} + {% block content %} + {% comment %} Delete the line below if you're just getting started and want to remove the welcome screen! {% endcomment %} + +
+
+
+

Aktuality

+
+
+

Dovolená

+
+
+
+
+
+
+ +
+ 18.6.2020 +
+
+
+ +
+ Školení na jatkách. +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+

Nemoc

+
+
+
+
+
+
+ +
+ 11.5.2020 - 16.5.2020 +
+
+
+ +
+ Od pondělí do pátku je veterina zavřena kvůli nemoci. +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+

Informace o klinice

+
+
+
Tento text mluví o tom že tato klinika je nejlepší v Ústeckím kraji. Má velmi rozšířené vedění o zvířatech od křečků až po šelmy. V budově vás přivítá velký sortiment kávy a sladkostí v podobě sušenek, nezapomnělo se ani na vaše nejmenší miláčky - v čekarně se nachazí i automat na pamlsko pro pejsky. To vše a jěště více u nás na klinice.
+
+
+
+
+

Otevírajicí doba

+
+
+
+ PO - PÁ: 08:00 - 16:00 +
+
+ SO - NE: 08:00 - 16:00 +
+
+ Svátky ZAVŘENO +
+
+
+
+
+
+{% endblock content %} \ No newline at end of file diff --git a/home/templates/home/welcome_page.html b/home/templates/home/welcome_page.html new file mode 100644 index 0000000..6368471 --- /dev/null +++ b/home/templates/home/welcome_page.html @@ -0,0 +1,52 @@ +{% load i18n wagtailcore_tags %} + +
+ + +
+
+
+ +
+
+

{% trans "Welcome to your new Wagtail site!" %}

+

{% trans 'Please feel free to join our community on Slack, or get started with one of the links below.' %}

+
+
+ diff --git a/kontakty/__init__.py b/kontakty/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/kontakty/admin.py b/kontakty/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/kontakty/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/kontakty/apps.py b/kontakty/apps.py new file mode 100644 index 0000000..71ce3d4 --- /dev/null +++ b/kontakty/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class KontaktyConfig(AppConfig): + name = 'kontakty' diff --git a/kontakty/migrations/0001_initial.py b/kontakty/migrations/0001_initial.py new file mode 100644 index 0000000..9ecae5e --- /dev/null +++ b/kontakty/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 3.1.3 on 2020-11-24 15:35 + +from django.db import migrations, models +import django.db.models.deletion +import wagtail.core.fields + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('wagtailcore', '0059_apply_collection_ordering'), + ] + + operations = [ + migrations.CreateModel( + name='KontaktyPage', + 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')), + ('body', wagtail.core.fields.RichTextField(blank=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + ] diff --git a/kontakty/migrations/__init__.py b/kontakty/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/kontakty/models.py b/kontakty/models.py new file mode 100644 index 0000000..f2cc922 --- /dev/null +++ b/kontakty/models.py @@ -0,0 +1,22 @@ +from django.db import models + +from modelcluster.fields import ParentalKey + +from wagtail.core.models import Page, Orderable +from wagtail.core.fields import RichTextField +from wagtail.admin.edit_handlers import FieldPanel, InlinePanel +from wagtail.images.edit_handlers import ImageChooserPanel +from wagtail.search import index + + +class KontaktyPage(Page): + body = RichTextField(blank=True) + + search_fields = Page.search_fields + [ + index.SearchField('body'), + ] + + content_panels = Page.content_panels + [ + FieldPanel('body', classname="full"), + ] + diff --git a/kontakty/templates/kontakty/kontakty_page.html b/kontakty/templates/kontakty/kontakty_page.html new file mode 100644 index 0000000..ab19f2f --- /dev/null +++ b/kontakty/templates/kontakty/kontakty_page.html @@ -0,0 +1,61 @@ +{% extends "base.html" %} + {% load static %} + {% block body_class %}template-homepage{% endblock %} + {% block extra_css %} + {% comment %} Delete the line below if you're just getting started and want to remove the welcome screen! {% endcomment %} + + {% endblock extra_css %} + {% block content %} + {% comment %} Delete the line below if you're just getting started and want to remove the welcome screen! {% endcomment %} +
+
+
+

Místo podnikání

+
+
+

Adresa

+
+
+ Lovosice, Pavlova 1356 +
+
+ +
+
+

Duležitá čísla

+
+
+
+
+

Ordinace

+
+
+ tel: 752 589 486 +
+
+
+
+
+
+

Doktorka

+
+
+ tel: 752 589 487 +
+
+
+
+
+
+

Sestra

+
+
+ tel: 752 589 488 +
+
+
+
+
+
+
+{% endblock content %} \ No newline at end of file diff --git a/kontakty/tests.py b/kontakty/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/kontakty/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/kontakty/views.py b/kontakty/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/kontakty/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..45ba9aa --- /dev/null +++ b/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "veterinahelcl.settings.dev") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/media/images/5412827_australsky-ovcak-pes-v1.max-165x165.jpg b/media/images/5412827_australsky-ovcak-pes-v1.max-165x165.jpg new file mode 100644 index 0000000..e0352bc Binary files /dev/null and b/media/images/5412827_australsky-ovcak-pes-v1.max-165x165.jpg differ diff --git a/media/images/5412827_australsky-ovcak-pes-v1.max-800x600.jpg b/media/images/5412827_australsky-ovcak-pes-v1.max-800x600.jpg new file mode 100644 index 0000000..9959514 Binary files /dev/null and b/media/images/5412827_australsky-ovcak-pes-v1.max-800x600.jpg differ diff --git a/media/images/5412827_australsky-ovcak-pes-v1.original.jpg b/media/images/5412827_australsky-ovcak-pes-v1.original.jpg new file mode 100644 index 0000000..f381ea1 Binary files /dev/null and b/media/images/5412827_australsky-ovcak-pes-v1.original.jpg differ diff --git a/media/original_images/5412827_australsky-ovcak-pes-v1.jpg b/media/original_images/5412827_australsky-ovcak-pes-v1.jpg new file mode 100644 index 0000000..031ed4e Binary files /dev/null and b/media/original_images/5412827_australsky-ovcak-pes-v1.jpg differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..574b6c3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +Django>=3.1,<3.2 +wagtail>=2.11,<2.12 diff --git a/search/__init__.py b/search/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/search/templates/search/search.html b/search/templates/search/search.html new file mode 100644 index 0000000..5f222e5 --- /dev/null +++ b/search/templates/search/search.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} +{% load static wagtailcore_tags %} + +{% block body_class %}template-searchresults{% endblock %} + +{% block title %}Search{% endblock %} + +{% block content %} +

Search

+ +
+ + +
+ + {% if search_results %} + + + {% if search_results.has_previous %} + Previous + {% endif %} + + {% if search_results.has_next %} + Next + {% endif %} + {% elif search_query %} + No results found + {% endif %} +{% endblock %} diff --git a/search/views.py b/search/views.py new file mode 100644 index 0000000..d9ad9d0 --- /dev/null +++ b/search/views.py @@ -0,0 +1,34 @@ +from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator +from django.template.response import TemplateResponse + +from wagtail.core.models import Page +from wagtail.search.models import Query + + +def search(request): + search_query = request.GET.get('query', None) + page = request.GET.get('page', 1) + + # Search + if search_query: + search_results = Page.objects.live().search(search_query) + query = Query.get(search_query) + + # Record hit + query.add_hit() + else: + search_results = Page.objects.none() + + # Pagination + paginator = Paginator(search_results, 10) + try: + search_results = paginator.page(page) + except PageNotAnInteger: + search_results = paginator.page(1) + except EmptyPage: + search_results = paginator.page(paginator.num_pages) + + return TemplateResponse(request, 'search/search.html', { + 'search_query': search_query, + 'search_results': search_results, + }) diff --git a/stranka/__init__.py b/stranka/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/stranka/admin.py b/stranka/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/stranka/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/stranka/apps.py b/stranka/apps.py new file mode 100644 index 0000000..8e66cb1 --- /dev/null +++ b/stranka/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class StrankaConfig(AppConfig): + name = 'stranka' diff --git a/stranka/migrations/0001_initial.py b/stranka/migrations/0001_initial.py new file mode 100644 index 0000000..ff2a241 --- /dev/null +++ b/stranka/migrations/0001_initial.py @@ -0,0 +1,44 @@ +# Generated by Django 3.1.3 on 2020-11-24 14:15 + +from django.db import migrations, models +import django.db.models.deletion +import modelcluster.fields +import wagtail.core.fields + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('wagtailcore', '0059_apply_collection_ordering'), + ('wagtailimages', '0022_uploadedimage'), + ] + + operations = [ + migrations.CreateModel( + name='StrankaPage', + 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')), + ('body', wagtail.core.fields.RichTextField(blank=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='StrankaPageGalleryImage', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('caption', models.CharField(blank=True, max_length=250)), + ('image', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailimages.image')), + ('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='gallery_images', to='stranka.strankapage')), + ], + options={ + 'ordering': ['sort_order'], + 'abstract': False, + }, + ), + ] diff --git a/stranka/migrations/__init__.py b/stranka/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/stranka/models.py b/stranka/models.py new file mode 100644 index 0000000..89806ea --- /dev/null +++ b/stranka/models.py @@ -0,0 +1,35 @@ +from django.db import models + +from modelcluster.fields import ParentalKey + +from wagtail.core.models import Page, Orderable +from wagtail.core.fields import RichTextField +from wagtail.admin.edit_handlers import FieldPanel, InlinePanel +from wagtail.images.edit_handlers import ImageChooserPanel +from wagtail.search import index + + +class StrankaPage(Page): + body = RichTextField(blank=True) + + search_fields = Page.search_fields + [ + index.SearchField('body'), + ] + + content_panels = Page.content_panels + [ + FieldPanel('body', classname="full"), + InlinePanel('gallery_images', label="Obrázky"), + ] + + +class StrankaPageGalleryImage(Orderable): + page = ParentalKey(StrankaPage, on_delete=models.CASCADE, related_name='gallery_images') + image = models.ForeignKey( + 'wagtailimages.Image', on_delete=models.CASCADE, related_name='+' + ) + caption = models.CharField(blank=True, max_length=250) + + panels = [ + ImageChooserPanel('image'), + FieldPanel('caption'), + ] \ No newline at end of file diff --git a/stranka/templates/stranka/stranka_page.html b/stranka/templates/stranka/stranka_page.html new file mode 100644 index 0000000..34d85eb --- /dev/null +++ b/stranka/templates/stranka/stranka_page.html @@ -0,0 +1,58 @@ +{% extends "base.html" %} + {% load static %} + {% block body_class %}template-homepage{% endblock %} + {% block extra_css %} + {% comment %} Delete the line below if you're just getting started and want to remove the welcome screen! {% endcomment %} + + {% endblock extra_css %} + {% block content %} + {% comment %} Delete the line below if you're just getting started and want to remove the welcome screen! {% endcomment %} + +
+
+
+

Služby

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Název služby Objednání Možné komplikace Cena
Zastřihávání drápků Ne Bez komplikací 120pč
Stříhaní srsti Ano Bez komplikací 150pč
Předoperační vyšetření Ano Bez komplikací 250pč
Operace hlay Ano Možná stráta domacího mazlíčka 2 500pč
+
+
+
+
+
+{% endblock content %} \ No newline at end of file diff --git a/stranka/tests.py b/stranka/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/stranka/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/stranka/views.py b/stranka/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/stranka/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/veterinahelcl/__init__.py b/veterinahelcl/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/veterinahelcl/settings/__init__.py b/veterinahelcl/settings/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/veterinahelcl/settings/base.py b/veterinahelcl/settings/base.py new file mode 100644 index 0000000..948dc7b --- /dev/null +++ b/veterinahelcl/settings/base.py @@ -0,0 +1,166 @@ +""" +Django settings for veterinahelcl project. + +Generated by 'django-admin startproject' using Django 3.1.3. + +For more information on this file, see +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.1/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os + +PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +BASE_DIR = os.path.dirname(PROJECT_DIR) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ + + +# Application definition + +INSTALLED_APPS = [ + 'home', + 'search', + + 'wagtail.contrib.forms', + 'wagtail.contrib.redirects', + 'wagtail.embeds', + 'wagtail.sites', + 'wagtail.users', + 'wagtail.snippets', + 'wagtail.documents', + 'wagtail.images', + 'wagtail.search', + 'wagtail.admin', + 'wagtail.core', + + 'modelcluster', + 'taggit', + + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + + 'diskuze', + 'stranka', + 'kontakty', +] + +MIDDLEWARE = [ + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.security.SecurityMiddleware', + + 'wagtail.contrib.redirects.middleware.RedirectMiddleware', +] + +ROOT_URLCONF = 'veterinahelcl.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + os.path.join(PROJECT_DIR, 'templates'), + ], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'veterinahelcl.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# 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.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.1/howto/static-files/ + +STATICFILES_FINDERS = [ + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +] + +STATICFILES_DIRS = [ + os.path.join(PROJECT_DIR, 'static'), +] + +# 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.1/ref/contrib/staticfiles/#manifeststaticfilesstorage +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' + +STATIC_ROOT = os.path.join(BASE_DIR, 'static') +STATIC_URL = '/static/' + +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +MEDIA_URL = '/media/' + + +# Wagtail settings + +WAGTAIL_SITE_NAME = "veterinahelcl" + +# Base URL to use when referring to full URLs within the Wagtail admin backend - +# e.g. in notification emails. Don't include '/admin' or a trailing slash +BASE_URL = 'http://example.com' diff --git a/veterinahelcl/settings/dev.py b/veterinahelcl/settings/dev.py new file mode 100644 index 0000000..7df5de4 --- /dev/null +++ b/veterinahelcl/settings/dev.py @@ -0,0 +1,18 @@ +from .base import * + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'vfybmc0_2a3z7q)h5m3qnpcv1q!$0=*gld4i(==br2v(%(=g-&' + +# SECURITY WARNING: define the correct hosts in production! +ALLOWED_HOSTS = ['*'] + +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + + +try: + from .local import * +except ImportError: + pass diff --git a/veterinahelcl/settings/production.py b/veterinahelcl/settings/production.py new file mode 100644 index 0000000..9ca4ed7 --- /dev/null +++ b/veterinahelcl/settings/production.py @@ -0,0 +1,8 @@ +from .base import * + +DEBUG = False + +try: + from .local import * +except ImportError: + pass diff --git a/veterinahelcl/static/css/veterinahelcl.css b/veterinahelcl/static/css/veterinahelcl.css new file mode 100644 index 0000000..e69de29 diff --git a/veterinahelcl/static/js/veterinahelcl.js b/veterinahelcl/static/js/veterinahelcl.js new file mode 100644 index 0000000..e69de29 diff --git a/veterinahelcl/templates/404.html b/veterinahelcl/templates/404.html new file mode 100644 index 0000000..3a5500e --- /dev/null +++ b/veterinahelcl/templates/404.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block body_class %}template-404{% endblock %} + +{% block content %} +

Page not found

+ +

Sorry, this page could not be found.

+{% endblock %} diff --git a/veterinahelcl/templates/500.html b/veterinahelcl/templates/500.html new file mode 100644 index 0000000..72b6406 --- /dev/null +++ b/veterinahelcl/templates/500.html @@ -0,0 +1,13 @@ + + + + + Internal server error + + + +

Internal server error

+ +

Sorry, there seems to be an error. Please try again soon.

+ + diff --git a/veterinahelcl/templates/base.html b/veterinahelcl/templates/base.html new file mode 100644 index 0000000..1f4bcda --- /dev/null +++ b/veterinahelcl/templates/base.html @@ -0,0 +1,56 @@ +{% load static wagtailuserbar %} + + + + + + + {% block title %} + {% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %} + {% endblock %} + {% block title_suffix %} + {% with self.get_site.site_name as site_name %} + {% if site_name %}- {{ site_name }}{% endif %} + {% endwith %} + {% endblock %} + + + + + + + + + {# Global stylesheets #} + + + + {% block extra_css %} + {# Override this in templates to add extra stylesheets #} + {% endblock %} + + + + {% wagtailuserbar %} +
+ + +
+ {% block content %}{% endblock %} + + {# Global javascript #} + + + + + + {% block extra_js %} + {# Override this in templates to add extra javascript #} + {% endblock %} + + diff --git a/veterinahelcl/urls.py b/veterinahelcl/urls.py new file mode 100644 index 0000000..d1b8710 --- /dev/null +++ b/veterinahelcl/urls.py @@ -0,0 +1,39 @@ +from django.conf import settings +from django.urls import include, path +from django.contrib import admin + +from wagtail.admin import urls as wagtailadmin_urls +from wagtail.core import urls as wagtail_urls +from wagtail.documents import urls as wagtaildocs_urls + +from search import views as search_views + +urlpatterns = [ + path('django-admin/', admin.site.urls), + + path('admin/', include(wagtailadmin_urls)), + path('documents/', include(wagtaildocs_urls)), + + path('search/', search_views.search, name='search'), + +] + + +if settings.DEBUG: + from django.conf.urls.static import static + from django.contrib.staticfiles.urls import staticfiles_urlpatterns + + # Serve static and media files from development server + urlpatterns += staticfiles_urlpatterns() + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + +urlpatterns = urlpatterns + [ + # For anything not caught by a more specific rule above, hand over to + # Wagtail's page serving mechanism. This should be the last pattern in + # the list: + path("", include(wagtail_urls)), + + # Alternatively, if you want Wagtail pages to be served from a subpath + # of your site, rather than the site root: + # path("pages/", include(wagtail_urls)), +] diff --git a/veterinahelcl/wsgi.py b/veterinahelcl/wsgi.py new file mode 100644 index 0000000..b7adef1 --- /dev/null +++ b/veterinahelcl/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for veterinahelcl 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.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "veterinahelcl.settings.dev") + +application = get_wsgi_application()