Permalink
Browse files

frontpage displays latest posts not only posts from same month

  • Loading branch information...
1 parent 79facea commit 62f64d1f6ae96cdf94d04659e5b7f5615d51ac33 Johan Bichel Lindegaard committed Jan 4, 2010
Showing with 10 additions and 13 deletions.
  1. +8 −5 templates/index.html
  2. +2 −8 views.py
View
@@ -1,11 +1,11 @@
{% extends 'base.html' %}
{% block meta-keywords %}
-alfakryl, avis, østre borgerdyd, artikler, nyheder, kultur
+avis, østre borgerdyd, artikler, nyheder, kultur, elev, gymnasie, uddannelse, københavn
{% endblock %}
{% block meta-description %}
-alfakryl er alfakrøll er snabela er @ på norsk er Østre Borgerdyds avis på the interwebs.
+Østre Borgerdyd Gymnasiets elevavis.
{% endblock %}
{% block title %}Forside{% endblock %}
@@ -15,19 +15,22 @@
<div class="span-5 append-1 leftsidebar">
<div class="cbox">
<h2>Mindst læste</h2>
+ {% with articles|dictsortreversed:"view_count"|slice:":6" as least_read %}
{% for object in least_read %}
-
<h3><a href="{{ object.get_absolute_url }}">
- {{ object.headline }}</a></h3>
+ {{ object.headline }}</a></h3>
{% endfor %}
+ {% endwith %}
</div>
<div class="cbox">
<h2>Mest læste</h2>
+ {% with articles|dictsort:"view_count"|slice:":6" as most_read %}
{% for object in most_read %}
<h3><a href="{{ object.get_absolute_url }}">
{{ object.headline }}</a></h3>
{% endfor %}
+ {% endwith %}
</div>
<!--
@@ -38,7 +41,7 @@
</div>
<div class="span-11 append-1 last article-list">
- {% with latest as object_list %}
+ {% with articles|slice:":4" as object_list %}
{% include "articles/list_snippet.html" %}
{% endwith %}
</div>
View
@@ -12,16 +12,10 @@ def user_is_writer(user):
return user.is_staff
def index(request):
- articles = Article.objects.published().filter(pub_date__month=datetime.now().month)
- latest = articles[:3]
- least_read = articles.order_by('view_count')[:5]
- most_read = articles.order_by('-view_count')[:5]
+ articles = Article.objects.published()[:16]
return render_to_response(
- 'index.html',
- {'latest': latest,
- 'least_read': least_read,
- 'most_read': most_read},
+ 'index.html', {'articles': articles,},
context_instance = RequestContext(request)
)

0 comments on commit 62f64d1

Please sign in to comment.