Changeset - 9ec1bbe85a76
[Not reviewed]
0 2 0
Bradley Kuhn (bkuhn) - 11 years ago 2010-10-04 15:27:04
bkuhn@ebb.org
Corrected front page code and template so that blog posts appear.
2 files changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
www/conservancy/frontpage.py
Show inline comments
 
from django.shortcuts import render_to_response
 
from conservancy.apps.news.models import PressRelease
 
from conservancy.apps.blog.models import Entry as BlogEntry
 
from datetime import datetime, timedelta
 

	
 
def view(request):
 
    """Conservancy front page view
 

	
 
    Performs all object queries necessary to render the front page.
 
    """
 

	
 
    press_releases = PressRelease.objects.all().filter(pub_date__lte=datetime.now(), sites=2)[:5]
 
    blog = BlogEntry.objects.all().filter(pub_date__lte=datetime.now())[:3]
 

	
 
    c = {
 
        'press_releases': press_releases,
 
        'blog' : blog
 
    }
 
    return render_to_response("frontpage.html", c)
www/conservancy/templates/frontpage.html
Show inline comments
...
 
@@ -43,13 +43,14 @@
 
<p class="date">{{ press_releases.0.pub_date|date:"F j, Y" }}</p>
 
<h3><a href="{{ press_releases.0.get_absolute_url }}">{{ press_releases.0.headline|safe }}</a></h3>
 
{{ press_releases.0.summary|safe }}
 
{% if press_releases.0.body %}<p><span class="continued"><a href="{{ press_releases.0.get_absolute_url }}">Read More...</a></span></p>{% endif %}
 
</div>
 
{% endif %}
 
<p><span class="continued"><a href="/news/">Conservancy News Archive&hellip;</a></p>
 
<p><span class="continued"><a href="/news/">Conservancy News
 
      Archive&hellip;</a></p>
 
{% if blog.0.is_recent %}
 
<h2><a href="/feeds/blog/" class="feedlink"><img src="/img/feed-icon-14x14.png" alt="[RSS]"/></a> <a href="/blog/">Conservancy Blog</a></h2>
 
<div class="shaded">
 
<p class="date">{{ blog.0.pub_date|date:"F j, Y" }}</p>
 
<h3><a href="{{ blog.0.get_absolute_url }}">{{ blog.0.headline|safe }}</a></h3>
 
{{ blog.0.summary|safe }}
0 comments (0 inline, 0 general)