kopia lustrzana https://github.com/rtts/django-simplecms
auto create empty homepage
rodzic
644ec5b6b4
commit
98b10502e5
|
@ -1,11 +1,8 @@
|
|||
# Generated by Django 2.1.7 on 2019-03-20 13:53
|
||||
|
||||
import ckeditor.fields
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import embed_video.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
from django.db import migrations
|
||||
|
||||
def add_homepage(apps, schema_editor):
|
||||
Page = apps.get_model('cms', 'Page')
|
||||
if not Page.objects.exists():
|
||||
Page(slug='', title='Homepage', position=1).save()
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cms', '0003_subsection'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(add_homepage, migrations.RunPython.noop),
|
||||
]
|
|
@ -1,62 +1,62 @@
|
|||
{% load i18n thumbnail embed_video_tags %}
|
||||
|
||||
<div class="wrapper">
|
||||
{% block section %}
|
||||
<div class="wrapper">
|
||||
|
||||
{% if section.image %}
|
||||
<div class="image">
|
||||
<img alt="" src="{% thumbnail section.image 800x800 %}">
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if section.title %}
|
||||
<div class="title">
|
||||
<h1>
|
||||
{{section.title}}
|
||||
</h1>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if section.content %}
|
||||
<div class="content">
|
||||
{{section.content|safe}}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if section.video %}
|
||||
<div class="video">
|
||||
<div class="iframe">
|
||||
{% video section.video '800x600' %}
|
||||
{% if section.image %}
|
||||
<div class="image">
|
||||
<img alt="{{section.title}}" src="{% thumbnail section.image 800x800 %}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if section.subsections.exists %}
|
||||
<div class="subsections">
|
||||
{% for sub in section.subsections.all %}
|
||||
<div class="subsection color{{sub.color}}">
|
||||
{% with section=sub user=None %}
|
||||
{% include 'cms/sections/base.html' %}
|
||||
{% endwith %}
|
||||
{% if section.title %}
|
||||
<div class="title">
|
||||
<h1>
|
||||
{{section.title}}
|
||||
</h1>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if section.content %}
|
||||
<div class="content">
|
||||
{{section.content|safe}}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if section.video %}
|
||||
<div class="video">
|
||||
<div class="iframe">
|
||||
{% video section.video '800x600' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% block extracontent %}
|
||||
</div>
|
||||
<div class="wrapper">
|
||||
{% endblock %}
|
||||
{% if section.subsections.exists %}
|
||||
<div class="subsections">
|
||||
{% for sub in section.subsections.all %}
|
||||
<div class="subsection color{{sub.color}}">
|
||||
{% with section=sub user=None %}
|
||||
{% include 'cms/sections/base.html' %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if section.button_text %}
|
||||
<div class="button">
|
||||
<a href="{{section.button_link}}">{{section.button_text}}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if section.button_text %}
|
||||
<div class="button">
|
||||
<a href="{{section.button_link}}">{{section.button_text}}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% if user.is_staff %}
|
||||
{% block extracontent %}{% endblock %}
|
||||
|
||||
{% if user.is_staff %}
|
||||
<div class="wrapper">
|
||||
<div class="edit">
|
||||
<a href="{% url 'cms:updatesection' section.pk %}">{% trans 'edit this section' %}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Ładowanie…
Reference in New Issue