# HG changeset patch # User Brian Neal # Date 1241484978 0 # Node ID 07da6967fc4050aa0efd8bc001e4c456d5f7cd87 # Parent 5eed5e7c1c98f77cb6c0928433132f0621dd29fc Created a current_news template tag for the home page. diff -r 5eed5e7c1c98 -r 07da6967fc40 gpp/news/templatetags/news_tags.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/news/templatetags/news_tags.py Tue May 05 00:56:18 2009 +0000 @@ -0,0 +1,19 @@ +""" +Template tags for the news application. +""" +from django import template + +from news.models import Story + + +register = template.Library() + + +@register.inclusion_tag('news/current_news.html', takes_context=True) +def current_news(context): + stories = Story.objects.all()[:10] + return { + 'stories': stories, + 'MEDIA_URL': context['MEDIA_URL'], + 'on_home': True, + } diff -r 5eed5e7c1c98 -r 07da6967fc40 gpp/templates/downloads/latest_tag.html --- a/gpp/templates/downloads/latest_tag.html Sun May 03 20:27:57 2009 +0000 +++ b/gpp/templates/downloads/latest_tag.html Tue May 05 00:56:18 2009 +0000 @@ -1,4 +1,4 @@ -

New Downloads

+

New Downloads

{% if downloads %}
    {% for dl in downloads %} diff -r 5eed5e7c1c98 -r 07da6967fc40 gpp/templates/home.html --- a/gpp/templates/home.html Sun May 03 20:27:57 2009 +0000 +++ b/gpp/templates/home.html Tue May 05 00:56:18 2009 +0000 @@ -1,8 +1,12 @@ {% extends 'base.html' %} {% load bulletin_tags %} +{% load news_tags %} {% load weblinks_tags %} {% load downloads_tags %} {% block title %}Home{% endblock %} +{% block custom_css %} + +{% endblock %} {% block content %}

    Welcome to SurfGuitar101!

    You are looking at a test version of the new SurfGuitar101 website, dubbed SG101 2.0. @@ -18,6 +22,7 @@ Also, I hope that the look and feel of this site can be greatly improved to something really cool! I'll need lots of help for this aspect, as I'm more of a coder than a designer.

    {% current_bulletins %} +{% current_news %}
    {% latest_weblinks %}
    diff -r 5eed5e7c1c98 -r 07da6967fc40 gpp/templates/news/current_news.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/news/current_news.html Tue May 05 00:56:18 2009 +0000 @@ -0,0 +1,10 @@ +{% load tagging_tags %} +{% if stories %} +

    Current News Stories

    +{% for story in stories %} + {% tags_for_object story as story_tags %} + {% include 'news/story_summary.html' %} +{% endfor %} +
    +

    For more news stories, check out our news archive.

    +{% endif %} diff -r 5eed5e7c1c98 -r 07da6967fc40 gpp/templates/news/story_summary.html --- a/gpp/templates/news/story_summary.html Sun May 03 20:27:57 2009 +0000 +++ b/gpp/templates/news/story_summary.html Tue May 05 00:56:18 2009 +0000 @@ -1,7 +1,11 @@ {% load comment_tags %} {% get_comment_count for story as comment_count %}
    +{% if on_home %} +

    {{ story.title }}

    +{% else %}

    {{ story.title }}

    +{% endif %}
    Submitted by {{ story.submitter.username }} on {{ story.date_published|date:"F d, Y" }}.
    diff -r 5eed5e7c1c98 -r 07da6967fc40 gpp/templates/weblinks/latest_tag.html --- a/gpp/templates/weblinks/latest_tag.html Sun May 03 20:27:57 2009 +0000 +++ b/gpp/templates/weblinks/latest_tag.html Tue May 05 00:56:18 2009 +0000 @@ -1,4 +1,4 @@ -

    New Links

    +

    New Links

    {% if links %}
      {% for link in links %}