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 = { context = {
'posts': posts, 'posts': posts,
'events': Event.objects.get_all_events(), 'events': Event.objects.order_by("-event_start").all(),
'featured_post': featured_post, 'featured_post': featured_post,
'featured_post2': FetMeeting.objects.first(), 'featured_post2': FetMeeting.objects.first(),
'tags_list': ", ".join(t) 'tags_list': ", ".join(t)

View File

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

View File

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

View File

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

View File

@@ -36,10 +36,17 @@
<hr> <hr>
{{post.body | safe}} {{post.body | safe}}
<hr> <hr>
tags:{{ post.get_tags }} {% for tag in post.get_tagnames %}
{{tag |tags_to_url}}
{% endfor %}
<hr> <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> </div>
{% endblock %} {% endfor %}
</div>
</div>
{% endblock %}fffsdfag