Changeset 8925
- Timestamp:
- 09/03/08 10:22:58 (3 months ago)
- Files:
-
- djangoproject.com/django_website/apps/blog/templatetags/weblog.py (moved) (moved from djangoproject.com/django_website/apps/blog/templatetags/latestblogentry.py) (1 diff)
- djangoproject.com/django_website/templates/base_weblog.html (modified) (1 diff)
- djangoproject.com/django_website/templates/blog/entry_snippet.html (added)
- djangoproject.com/django_website/templates/blog/month_links_snippet.html (added)
- djangoproject.com/django_website/templates/flatpages/homepage.html (modified) (1 diff)
- djangoproject.com/django_website/templates/registration/activation_email.txt (modified) (1 diff)
- djangoproject.com/django_website/templates/registration/password_reset_email.html (added)
- djangoproject.com/django_website/templates/registration/registration_form.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
djangoproject.com/django_website/apps/blog/templatetags/weblog.py
r3536 r8925 1 import datetime 1 2 from django import template 2 3 from django_website.apps.blog.models import Entry 3 import datetime4 5 class LatestBlogEntriesNode(template.Node):6 def __init__(self, num, varname):7 self.num, self.varname = num, varname8 9 def render(self, context):10 context[self.varname] = list(Entry.objects.filter(pub_date__lte=datetime.datetime.now())[:self.num])11 return ''12 13 def do_get_latest_blog_entries(parser, token):14 """15 {% get_latest_blog_entries 2 as latest_entries %}16 """17 bits = token.contents.split()18 if len(bits) != 4:19 raise template.TemplateSyntaxError, "'%s' tag takes three arguments" % bits[0]20 if bits[2] != 'as':21 raise template.TemplateSyntaxError, "First argument to '%s' tag must be 'as'" % bits[0]22 return LatestBlogEntriesNode(bits[1], bits[3])23 4 24 5 register = template.Library() 25 register.tag('get_latest_blog_entries', do_get_latest_blog_entries) 6 7 @register.inclusion_tag('blog/entry_snippet.html') 8 def render_latest_blog_entries(num): 9 entries = Entry.objects.filter(pub_date__lte=datetime.datetime.now())[:num] 10 return { 11 'entries': entries, 12 } 13 14 @register.inclusion_tag('blog/month_links_snippet.html') 15 def render_month_links(): 16 return { 17 'dates': Entry.objects.dates('pub_date', 'month'), 18 } djangoproject.com/django_website/templates/base_weblog.html
r7892 r8925 13 13 {% block content-related %} 14 14 <h2>Archives</h2> 15 <ul class="linklist"> 16 <li><a href="/weblog/2008/apr/">April 2008</a></li> 17 <li><a href="/weblog/2008/mar/">March 2008</a></li> 18 <li><a href="/weblog/2008/feb/">Febuary 2008</a></li> 19 <li><a href="/weblog/2008/jan/">January 2008</a></li> 20 <li><a href="/weblog/2007/dec/">December 2007</a></li> 21 <li><a href="/weblog/2007/nov/">November 2007</a></li> 22 <li><a href="/weblog/2007/oct/">October 2007</a></li> 23 <li><a href="/weblog/2007/sep/">September 2007</a></li> 24 <li><a href="/weblog/2007/aug/">August 2007</a></li> 25 <li><a href="/weblog/2007/jul/">July 2007</a></li> 26 <li><a href="/weblog/2007/jun/">June 2007</a></li> 27 <li><a href="/weblog/2007/may/">May 2007</a></li> 28 <li><a href="/weblog/2007/apr/">April 2007</a></li> 29 <li><a href="/weblog/2007/mar/">March 2007</a></li> 30 <li><a href="/weblog/2007/feb/">February 2007</a></li> 31 <li><a href="/weblog/2007/jan/">January 2007</a></li> 32 <li><a href="/weblog/2006/dec/">December 2006</a></li> 33 <li><a href="/weblog/2006/nov/">November 2006</a></li> 34 <li><a href="/weblog/2006/oct/">October 2006</a></li> 35 <li><a href="/weblog/2006/sep/">September 2006</a></li> 36 <li><a href="/weblog/2006/aug/">August 2006</a></li> 37 <li><a href="/weblog/2006/jul/">July 2006</a></li> 38 <li><a href="/weblog/2006/jun/">June 2006</a></li> 39 <li><a href="/weblog/2006/may/">May 2006</a></li> 40 <li><a href="/weblog/2006/apr/">April 2006</a></li> 41 <li><a href="/weblog/2006/mar/">March 2006</a></li> 42 <li><a href="/weblog/2006/feb/">February 2006</a></li> 43 <li><a href="/weblog/2006/jan/">January 2006</a></li> 44 <li><a href="/weblog/2005/dec/">December 2005</a></li> 45 <li><a href="/weblog/2005/nov/">November 2005</a></li> 46 <li><a href="/weblog/2005/oct/">October 2005</a></li> 47 <li><a href="/weblog/2005/sep/">September 2005</a></li> 48 <li><a href="/weblog/2005/aug/">August 2005</a></li> 49 <li><a href="/weblog/2005/jul/">July 2005</a></li> 50 </ul> 15 {% load weblog %}{% render_month_links %} 51 16 52 17 <h2>RSS feeds</h2> djangoproject.com/django_website/templates/flatpages/homepage.html
r8876 r8925 69 69 {% block content-extra %} 70 70 <h2>Weblog</h2> 71 72 {% load comments comment_utils latestblogentry %} 73 {% get_latest_blog_entries 4 as latest_entries %} 74 75 {% for latest_entry in latest_entries %} 76 <h3><a href="{{ latest_entry.get_absolute_url }}">{{ latest_entry.headline }}</a></h3> 77 <p class="date">by <strong>{{ latest_entry.author }}</strong> on {{ latest_entry.pub_date|date:"M. j, Y" }}</p> 78 {{ latest_entry.summary }} 79 <p class="more"><a href="{{ latest_entry.get_absolute_url }}">Read more</a>{% if comment_count %} / <a href="{{ latest_entry.get_absolute_url }}#comments">{{ comment_count }} comment{{ comment_count|pluralize }}</a>{% endif %}</p> 80 {% endfor %} 81 82 {% comment %} 83 <blockquote class="fancyquote"> 84 <p>Django's cool. I should know because I’m British.</p> 85 <cite><strong>Simon Willison</strong><br />Mad Genius</cite> 86 </blockquote> 87 {% endcomment %} 88 71 {% load weblog %}{% render_latest_blog_entries 4 %} 89 72 {% endblock %} djangoproject.com/django_website/templates/registration/activation_email.txt
r7369 r8925 1 1 {% load humanize %} 2 Someone, hopefully you, signed up for a new account at {{ site_url }}using this email address. If it was you, and you'd like to activate and use your account, click the link below or copy and paste it into your web browser's address bar:2 Someone, hopefully you, signed up for a new account at djangoproject.com using this email address. If it was you, and you'd like to activate and use your account, click the link below or copy and paste it into your web browser's address bar: 3 3 4 4 http://www.djangoproject.com/accounts/activate/{{ activation_key }}/ djangoproject.com/django_website/templates/registration/registration_form.html
r7369 r8925 25 25 <dt> 26 26 <label for="id_email">Email address:</label> 27 </d d>27 </dt> 28 28 <dd> 29 29 {{ form.email }}
