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 display flex
margin-bottom 0
flex 1
flex-direction column flex-direction column
justify-content center justify-content center
> li > li

View file

@ -6,6 +6,13 @@ $xl = 1200px
main main
flex-direction column flex-direction column
align-items center align-items center
aside.author
margin-bottom 1rem
@media (min-width $md) @media (min-width $md)
flex-direction row-reverse flex-direction row-reverse
align-items unset 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 %} {% load static %}
{% block styles %} {% block styles %}
<link rel="stylesheet" type="text/stylus" href="{% static 'home/css/index.styl' %}" /> <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 %} {% endblock %}
{% block main %} {% block main %}
<aside class="author"> <aside class="author">
@ -35,4 +36,11 @@
</div> </div>
</article> </article>
</aside> </aside>
<ol class="list-unstyled entries">
{% for entry in entries %}
<li>
{% include 'entries/h-entry.html' %}
</li>
{% endfor %}
</ol>
{% endblock %} {% endblock %}

View file

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