From 60cd6c911b45173ff627e4d08e952b6ee54e596f Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Wed, 25 Oct 2017 12:55:24 +1100 Subject: [PATCH] Add entries to the homepage, and make style tweaks so everywhere looks right --- entries/static/entries/css/h-entry.styl | 4 +++- home/static/home/css/index.styl | 7 +++++++ home/templates/home/index.html | 8 ++++++++ home/views.py | 3 +++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/entries/static/entries/css/h-entry.styl b/entries/static/entries/css/h-entry.styl index 190ac6c..38ef5c4 100644 --- a/entries/static/entries/css/h-entry.styl +++ b/entries/static/entries/css/h-entry.styl @@ -1,5 +1,7 @@ -main > .container +ol.entries display flex + margin-bottom 0 + flex 1 flex-direction column justify-content center > li diff --git a/home/static/home/css/index.styl b/home/static/home/css/index.styl index 37bce22..e7319eb 100644 --- a/home/static/home/css/index.styl +++ b/home/static/home/css/index.styl @@ -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 diff --git a/home/templates/home/index.html b/home/templates/home/index.html index b8672c1..5a73d07 100644 --- a/home/templates/home/index.html +++ b/home/templates/home/index.html @@ -2,6 +2,7 @@ {% load static %} {% block styles %} + {% endblock %} {% block main %} +
    + {% for entry in entries %} +
  1. + {% include 'entries/h-entry.html' %} +
  2. + {% endfor %} +
{% endblock %} diff --git a/home/views.py b/home/views.py index e2060b3..abd7c79 100644 --- a/home/views.py +++ b/home/views.py @@ -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), })