This commit is contained in:
2020-09-08 11:55:05 +00:00
3 changed files with 28 additions and 5 deletions

View File

@@ -148,14 +148,16 @@ class Post(models.Model):
self.slug = slugify(self.public_date.date()) + "-" + slugify(self.title)
if self.has_agenda :
if self.has_agenda: # and (self.agenda_key == "" or self.agenda_key is None):
self.agenda_key = ep.createPadifNotExists(self.slug + "agenda")
if self.has_protocol:
self.protocol_key = ep.createPadifNotExists(self.slug+"protocol")
super().save(*args, **kwargs)
self.tags.set(
@@ -257,7 +259,7 @@ class FetMeeting(Event):
if not self.slug:
self.slug = slugify(self.event_start.date()) + "-" + slugify(self.title)
self.body = "TODO: Agenda + Protokoll Link"
# TODO
# self.image

View File

@@ -70,6 +70,8 @@ def show(request, id=None):
if post_author:
author_image = post_author.image['avatar'].url
ep_link = (get_pad_link(p.agenda_key), get_pad_link(p.protocol_key))
context = {
"post": p,
"author_image": author_image,
@@ -77,6 +79,7 @@ def show(request, id=None):
"related_posts": p.tags.similar_objects(),
"ep_agenda_link": get_pad_link(p.agenda_key),
"ep_protocol_link": get_pad_link(p.protocol_key),
}
response = render(request, 'posts/show.html', context)

View File

@@ -1,7 +1,7 @@
{% extends "layout.html" %}
{% load post_helpers %}
{% load thumbnail %}{% load admin_urls %}
{% load admin_urls %}
{% block content %}
<div class="large-article-header" style="background-image:url('{{post.imageurl}}')">
@@ -44,7 +44,6 @@
<div class="cell medium-4">
{% include 'posts/partials/_date_box.html' %}
{% if post.has_agenda %}
<a href="{{ep_agenda_link}}">Agenda</a><br>
{% endif %}
@@ -54,9 +53,28 @@
{% endif %}
</div>
</div>
--
<a href="{% url "admin:posts_news_change" post.id %}">Bearbeiten</a>
Start: {{post.event_start}}<br>
Ende: {{post.event_end}}<br>
{% if post.has_agenda %}
<a href="{{ep_link.0}}">Agenda</a>
{% endif %}
{% if post.has_protocol %}
<a href="{{ep_link.1}}">Protokoll</a>
{% endif %}
{% if request.user.is_authenticated %}
<br>------<br>
<a href="{% url "admin:posts_news_change" post.id %}">Bearbeiten</a>
{% endif %}
<hr>
{{post.body | safe | add_internal_links | tags_to_url}}
<hr>
{% for tag in post.get_tagnames %}
{{tag |tags_to_url}}