# HG changeset patch # User Brian Neal # Date 1240360482 0 # Node ID 04377c5bf9124cdf00f6ddb082cda2e031cb4f0f # Parent 03144b0d470d3609be926729ceeac17f297955ab Added bulletins template tag. diff -r 03144b0d470d -r 04377c5bf912 gpp/bulletins/templatetags/bulletin_tags.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/bulletins/templatetags/bulletin_tags.py Wed Apr 22 00:34:42 2009 +0000 @@ -0,0 +1,17 @@ +""" +Template tags for the bulletins application. +""" +from django import template + +from bulletins.models import Bulletin + + +register = template.Library() + + +@register.inclusion_tag('bulletins/bulletins.html') +def current_bulletins(): + bulletins = Bulletin.objects.get_current() + return { + 'bulletins': bulletins, + } diff -r 03144b0d470d -r 04377c5bf912 gpp/settings.py --- a/gpp/settings.py Tue Apr 21 23:25:05 2009 +0000 +++ b/gpp/settings.py Wed Apr 22 00:34:42 2009 +0000 @@ -93,6 +93,7 @@ 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', + 'django.contrib.humanize', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.markup', diff -r 03144b0d470d -r 04377c5bf912 gpp/templates/bulletins/bulletins.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/bulletins/bulletins.html Wed Apr 22 00:34:42 2009 +0000 @@ -0,0 +1,11 @@ +{% load humanize %} +{% for bulletin in bulletins %} +
+

{{ bulletin.title }}

+
+ {{ bulletin.text|safe }} +
+

Posted: {{ bulletin.start_date|naturalday|capfirst }} + {{ bulletin.start_date|date:"H:i" }}.

+
+{% endfor %} diff -r 03144b0d470d -r 04377c5bf912 gpp/templates/home.html --- a/gpp/templates/home.html Tue Apr 21 23:25:05 2009 +0000 +++ b/gpp/templates/home.html Wed Apr 22 00:34:42 2009 +0000 @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% load bulletin_tags %} {% load weblinks_tags %} {% load downloads_tags %} {% block title %}Home{% endblock %} @@ -16,6 +17,7 @@ permanent. The site (content, user accounts, etc.) may be wiped at any time while we fix bugs and add features. 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 %}
{% latest_weblinks %}
diff -r 03144b0d470d -r 04377c5bf912 media/css/base.css --- a/media/css/base.css Tue Apr 21 23:25:05 2009 +0000 +++ b/media/css/base.css Wed Apr 22 00:34:42 2009 +0000 @@ -112,3 +112,19 @@ text-align: center; padding: 0.5em; } +.bulletin { + text-align: center; + margin: 1em 1em; + padding: 1em 1em 0; + border: 1px solid black; +} +.bulletin h3 { + background-image: url(../icons/asterisk_orange.png); + background-position: center left; + background-repeat: no-repeat; +} +.bulletin .bulletin-meta { + font-size: x-small; + color: gray; + text-align: right; +} diff -r 03144b0d470d -r 04377c5bf912 media/icons/asterisk_orange.png Binary file media/icons/asterisk_orange.png has changed