Commit ed9749ba authored by Dennis Appel's avatar Dennis Appel

Update link checklist categories to wiki

parent 6de87ecf
# Generated by Django 2.1.3 on 2018-12-16 11:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wiki', '0001_initial'),
('checklist', '0004_auto_20181213_1505'),
]
operations = [
migrations.RemoveField(
model_name='checklistentry',
name='wikiEntry',
),
migrations.AddField(
model_name='checklistcategory',
name='wikiEntry',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='wiki.WikiEntry'),
),
]
...@@ -2,6 +2,8 @@ from django.db import models ...@@ -2,6 +2,8 @@ from django.db import models
class CheckListCategory(models.Model): class CheckListCategory(models.Model):
wikiEntry = models.ForeignKey(
'wiki.WikiEntry', on_delete=models.SET_NULL, blank=True, null=True)
categoryTitle = models.CharField(max_length=100) categoryTitle = models.CharField(max_length=100)
def getEntries(self): def getEntries(self):
...@@ -12,8 +14,6 @@ class CheckListCategory(models.Model): ...@@ -12,8 +14,6 @@ class CheckListCategory(models.Model):
class CheckListEntry(models.Model): class CheckListEntry(models.Model):
wikiEntry = models.ForeignKey(
'wiki.WikiEntry', on_delete=models.SET_NULL, blank=True, null=True)
checklistCategory = models.ForeignKey( checklistCategory = models.ForeignKey(
'checklist.CheckListCategory', on_delete=models.SET_DEFAULT, default=1) 'checklist.CheckListCategory', on_delete=models.SET_DEFAULT, default=1)
checkListEntryTitle = models.CharField(max_length=200) checkListEntryTitle = models.CharField(max_length=200)
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<div class="grid-x"> <div class="grid-x">
<div class="cell cell-background-lg" id="category_{{category.id}}" name="category_{{category.id}}"> <div class="cell cell-background-lg" id="category_{{category.id}}" name="category_{{category.id}}">
<h3>{{category.categoryTitle}}</h3> <h3>{{category.categoryTitle}}</h3>
<a class="link" href="{% url 'wiki:index' %}#item_{{category.wikiEntry.id}}"><button class="hollow button">Wiki</button></a>
</div> </div>
{% for entry in category.getEntries %} {% for entry in category.getEntries %}
<div class="cell cell-background-lg" id="entry_{{entry.id}}" name="entry_{{entry.id}}"> <div class="cell cell-background-lg" id="entry_{{entry.id}}" name="entry_{{entry.id}}">
...@@ -51,7 +52,6 @@ ...@@ -51,7 +52,6 @@
</p> </p>
<button class="button" onclick="checkListToggle(this, {{entry.id}})">Abschlie&szlig;en</button> <button class="button" onclick="checkListToggle(this, {{entry.id}})">Abschlie&szlig;en</button>
{% if entry.wikiEntry.id %} {% if entry.wikiEntry.id %}
<a class="link" href="{% url 'wiki:index' %}#item_{{entry.wikiEntry.id}}"><button class="hollow button">Wiki</button></a>
{% endif %} {% endif %}
<a class="link" href="#checklist-navigation"><button class="button hollow">Zur&uuml;ck</button></a> <a class="link" href="#checklist-navigation"><button class="button hollow">Zur&uuml;ck</button></a>
</div> </div>
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<section> <section>
<div class="cell cell-background-lg vertical-space" id="item_{{entry.id}}" name="item_{{entry.id}}"> <div class="cell cell-background-lg vertical-space" id="item_{{entry.id}}" name="item_{{entry.id}}">
<h2>{{entry.wikiTitle}}</h2> <h2>{{entry.wikiTitle}}</h2>
<p>{{entry.wikiText}}</p> <p>{{entry.wikiText|safe}}</p>
<a class="link" href="#wiki-navigation">Zur&uuml;ck</a> <a class="link" href="#wiki-navigation">Zur&uuml;ck</a>
{% if entry.wikiexample_set.all %} {% if entry.wikiexample_set.all %}
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<div class="callout success example-callout"> <div class="callout success example-callout">
<h3>{{example.exampleTitle}}</h3> <h3>{{example.exampleTitle}}</h3>
<img class="example-image" src="{% static 'images/examples/' %}{{example.exampleImage}}" alt="{{example.exampleImageAlt}}"> <img class="example-image" src="{% static 'images/examples/' %}{{example.exampleImage}}" alt="{{example.exampleImageAlt}}">
<p>{{example.exampleText}}</p> <p>{{example.exampleText|safe}}</p>
</div> </div>
</div> </div>
{% endfor %} {% 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