Add entries to the homepage, and make style tweaks so everywhere looks right

This commit is contained in:
Danielle McLean 2017-10-25 12:55:24 +11:00
parent 172f0d4753
commit 60cd6c911b
Signed by: 00dani
GPG Key ID: 5A5D2D1AFF12EEC5
4 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,7 @@
main > .container
ol.entries
display flex
margin-bottom 0
flex 1
flex-direction column
justify-content center
> li

View File

@ -6,6 +6,13 @@ $xl = 1200px
main
flex-direction column
align-items center
aside.author
margin-bottom 1rem
@media (min-width $md)
flex-direction row-reverse
align-items unset
aside.author
margin-bottom 0
ol.entries
margin-right 2rem
justify-content flex-start

View File

@ -2,6 +2,7 @@
{% load static %}
{% block styles %}
<link rel="stylesheet" type="text/stylus" href="{% static 'home/css/index.styl' %}" />
<link rel="stylesheet" type="text/stylus" href="{% static 'entries/css/h-entry.styl' %}" />
{% endblock %}
{% block main %}
<aside class="author">
@ -35,4 +36,11 @@
</div>
</article>
</aside>
<ol class="list-unstyled entries">
{% for entry in entries %}
<li>
{% include 'entries/h-entry.html' %}
</li>
{% endfor %}
</ol>
{% endblock %}

View File

@ -1,5 +1,6 @@
from django.shortcuts import get_object_or_404, render
from users.models import User
from entries.models import Entry
from lemoncurry import breadcrumbs
breadcrumbs.add('home:index', 'home')
@ -7,7 +8,9 @@ breadcrumbs.add('home:index', 'home')
def index(request):
user = get_object_or_404(User, pk=1)
entries = Entry.objects.filter(author=user)
return render(request, 'home/index.html', {
'user': user,
'entries': entries,
'meta': user.as_meta(request),
})