Commit 5b3cec15 authored by Dennis Appel's avatar Dennis Appel

Add wiki examples

parent 2c24ec65
......@@ -137,4 +137,7 @@ STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
django_heroku.settings(locals())
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -52,3 +52,15 @@ html, body {
height: 100%;
}
}
.example-image {
width: 50%;
float: left;
margin-right: 15px;
}
.example-callout {
height:100%;
padding-bottom: 10px;
float: left;
}
# Generated by Django 2.1.3 on 2018-11-19 14:27
# Generated by Django 2.1.3 on 2018-11-19 15:05
from django.db import migrations, models
import django.db.models.deletion
......@@ -29,7 +29,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('exampleTitle', models.CharField(max_length=200)),
('exampleText', models.TextField()),
('exampleResource', models.FileField(blank=True, upload_to='')),
('exampleResource', models.CharField(blank=True, max_length=200)),
('examplePositive', models.BooleanField(default=True)),
('wikiEntry', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='wiki.WikiEntry')),
],
......
# Generated by Django 2.1.3 on 2018-11-19 15:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wiki', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='wikiexample',
old_name='exampleResource',
new_name='exampleImage',
),
]
# Generated by Django 2.1.3 on 2018-11-19 15:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wiki', '0002_auto_20181119_1606'),
]
operations = [
migrations.AddField(
model_name='wikiexample',
name='exampleResource',
field=models.CharField(blank=True, max_length=200),
),
]
# Generated by Django 2.1.3 on 2018-11-19 15:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wiki', '0003_wikiexample_exampleresource'),
]
operations = [
migrations.RemoveField(
model_name='wikiexample',
name='exampleResource',
),
migrations.AlterField(
model_name='wikiexample',
name='exampleImage',
field=models.CharField(max_length=200),
),
]
# Generated by Django 2.1.3 on 2018-11-19 15:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wiki', '0004_auto_20181119_1610'),
]
operations = [
migrations.RemoveField(
model_name='wikiexample',
name='exampleText',
),
]
# Generated by Django 2.1.3 on 2018-11-19 15:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wiki', '0005_remove_wikiexample_exampletext'),
]
operations = [
migrations.AddField(
model_name='wikiexample',
name='exampleText',
field=models.TextField(default='Beispiel'),
),
]
......@@ -5,6 +5,12 @@ class WikiEntry(models.Model):
wikiTitle = models.CharField(max_length=200)
wikiText = models.TextField()
def getPositiveExamples(self):
return self.wikiexample_set.filter(examplePositive=True)
def getNegativeExamples(self):
return self.wikiexample_set.filter(examplePositive=False)
def __str__(self):
return self.wikiTitle
......@@ -16,8 +22,8 @@ class WikiExample(models.Model):
wikiEntry = models.ForeignKey(
WikiEntry, on_delete=models.SET_NULL, null=True)
exampleTitle = models.CharField(max_length=200)
exampleText = models.TextField()
exampleResource = models.FileField(blank=True)
exampleText = models.TextField(default="Beispiel")
exampleImage = models.CharField(max_length=200)
examplePositive = models.BooleanField(default=True)
def __str__(self):
......
{% extends "base.html" %}
{% load staticfiles %}
{% block title %}
{% with title="Startseite" %}
{{ block.super }}
......@@ -15,7 +17,7 @@
<div class="cell large-2 cell-background-wiki-mg wiki-navigation">
<div name="wiki-navigation" id="wiki-navigation" class="text-center">
<h4>Inhaltsverzeichnis</h4>
<h4>Inhaltsverzeichnis</h4>
</div>
<ul class="vertical menu">
{% for entry in wiki_list %}
......@@ -37,21 +39,37 @@
{% if entry.wikiexample_set.all %}
{% for example in entry.wikiexample_set.all %}
{% if example.examplePositive %}
<div class="callout success">
<h3>{{example.exampleTitle}}</h3>
<p>{{example.exampleText}}</p>
</div>
{% else %}
<div class="callout alert">
<h3>{{example.exampleTitle}}</h3>
<p>{{example.exampleText}}</p>
<div class="grid-x grid-margin-x">
<div class="cell large-6">
<div class="grid-x">
{% for example in entry.getPositiveExamples %}
<div class="cell vertical-space-small">
<div class="callout success example-callout">
<h3>{{example.exampleTitle}}</h3>
<img class="example-image" src="{% static 'images/examples/' %}{{example.exampleImage}}">
<p>{{example.exampleText}}</p>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="cell large-6">
<div class="grid-x">
{% for example in entry.getNegativeExamples %}
<div class="cell vertical-space-small">
<div class="callout alert example-callout">
<h3>{{example.exampleTitle}}</h3>
<img class="example-image" src="{% static 'images/examples/' %}{{example.exampleImage}}">
<p>{{example.exampleText}}</p>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
</section>
{% endfor %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment