protocol & grid post show

This commit is contained in:
2020-09-08 11:52:10 +00:00
parent f9dbd97a87
commit 5bf1ba3807
3 changed files with 21 additions and 14 deletions

View File

@@ -148,14 +148,13 @@ class Post(models.Model):
self.slug = slugify(self.public_date.date()) + "-" + slugify(self.title) self.slug = slugify(self.public_date.date()) + "-" + slugify(self.title)
if self.has_agenda: # and (self.agenda_key == "" or self.agenda_key is None): if self.has_agenda :
self.agenda_key = ep.createPadifNotExists(self.slug + "agenda") self.agenda_key = ep.createPadifNotExists(self.slug + "agenda")
print("AgendaKey: %s" % self.agenda_key)
if self.has_protocol:
if self.has_protocol and (self.agenda_key == "" or self.agenda_key is None): self.protocol_key = ep.createPadifNotExists(self.slug+"protocol")
self.protocol_key = ep.createPadifNotExists(self.slug+"-protocol")
print("should initialize protocol document")
super().save(*args, **kwargs) super().save(*args, **kwargs)

View File

@@ -75,7 +75,8 @@ def show(request, id=None):
"author_image": author_image, "author_image": author_image,
"next": get_next_dict(p), "next": get_next_dict(p),
"related_posts": p.tags.similar_objects(), "related_posts": p.tags.similar_objects(),
"ep_link": get_pad_link(p.agenda_key), "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) response = render(request, 'posts/show.html', context)

View File

@@ -34,29 +34,36 @@
</div> </div>
</div></div> </div></div>
<div class="grid-container"> <div class="grid-container">
<div class="grid-x">
<div class="cell medium-8">
<h1>{{post.title | tags_to_url }}</h1> <h1>{{post.title | tags_to_url }}</h1>
<strong>{{post.subtitle | tags_to_url }}</strong><span class="nav fa fa-chevron-right fa-3x"></span> <strong>{{post.subtitle | tags_to_url }}</strong><span class="nav fa fa-chevron-right fa-3x"></span>
<br> <br>
<a href="{% url 'posts.show' next %}">Nächster Artikel</a><br> <a href="{% url 'posts.show' next %}">Nächster Artikel</a><br>
</div>
<div class="cell medium-4">
{% include 'posts/partials/_date_box.html' %} {% include 'posts/partials/_date_box.html' %}
{{post.event_start}}
{{post.event_end}}
{% if post.has_agenda %} {% if post.has_agenda %}
<a href="{{ep_link}}">EP</a> <a href="{{ep_agenda_link}}">Agenda</a><br>
{% endif %} {% endif %}
{% if post.has_protocol %}
<a href="{{ep_protocol_link}}">Protocol</a>
{% endif %}
</div>
</div>
-- --
<a href="{% url "admin:posts_news_change" post.id %}">Bearbeiten</a> <a href="{% url "admin:posts_news_change" post.id %}">Bearbeiten</a>
<hr>
{{post.body | safe | add_internal_links | tags_to_url}}
<hr> <hr>
{% for tag in post.get_tagnames %} {% for tag in post.get_tagnames %}
{{tag |tags_to_url}} {{tag |tags_to_url}}
{% endfor %} {% endfor %}
<hr>
{{post.body | safe | add_internal_links | tags_to_url}}
<hr> <hr>
<div class="grid-x grid-margin-x"> <div class="grid-x grid-margin-x">