layout events

This commit is contained in:
2020-08-26 20:11:57 +00:00
parent e847a2bfc6
commit 9164f13c6a
5 changed files with 30 additions and 11 deletions

View File

@@ -20,7 +20,7 @@ def index(request):
context = {
'posts': posts,
'events': Event.objects.get_all_events(),
'events': Event.objects.order_by("-event_start").all(),
'featured_post': featured_post,
'featured_post2': FetMeeting.objects.first(),
'tags_list': ", ".join(t)

View File

@@ -145,6 +145,10 @@ class Post(models.Model):
"""Returns assigned tags as a comma seperated list."""
return ",".join(self.tags.names())
@property
def get_tagnames(self):
return ["#%s" % t for t in self.tags.names()]
def imageurl(self):
""" returns the url to the image"""
if self.image:
@@ -231,7 +235,12 @@ class Event(Post):
class Meta:
proxy = True
@property
def event_start_month (self):
return self.event_start.strftime("%b")
@property
def event_start_day(self):
return self.event_start.strftime("%d")
def save(self, *args, **kwargs):
self.is_event = True

View File

@@ -28,10 +28,13 @@
</ul>
</div>
</div>
{% block content %}
{% endblock %}
<div class="grid-x">
<div class="cell medium-6">
<a href ="/admin">admin</a>
</div>
</div>
<!-- App.js -->
<script src="{%static 'app.js' %}"></script>
</body>

View File

@@ -2,8 +2,8 @@
<div class="date-box">
<span>
<span class="date-badge badge primary" style="">
<span class="date-badge-day">16</span>
<span class="date-badge-month">Apr</span>
<span class="date-badge-day">{{post.event_start_day}}</span>
<span class="date-badge-month">{{post.event_start_month}}</span>
</span></span>
<span class="date-text"><strong>{{post.title}}</strong></span>

View File

@@ -36,10 +36,17 @@
<hr>
{{post.body | safe}}
<hr>
tags:{{ post.get_tags }}
{% for tag in post.get_tagnames %}
{{tag |tags_to_url}}
{% endfor %}
<hr>
<div class="grid-x grid-padding">
{{related_posts}}
{% for post in related_posts %}
<div class="medium-6 large-4 small-12 cell">
{% include 'posts/partials/_posts_hero.html' %}
</div>
{% endblock %}
{% endfor %}
</div>
</div>
{% endblock %}fffsdfag