# HG changeset patch # User Brian Neal # Date 1240175819 0 # Node ID a5f27f25fa52e8461026aea9f96bca2d19ed27e9 # Parent 42f22c56ab05a2249a31e2e32487991794987023 Added a latest_downloads template tag. Made the comments view the details view for a download. Changed get_absolute_url to point to this new view. diff -r 42f22c56ab05 -r a5f27f25fa52 gpp/downloads/models.py --- a/gpp/downloads/models.py Sun Apr 19 21:01:15 2009 +0000 +++ b/gpp/downloads/models.py Sun Apr 19 21:16:59 2009 +0000 @@ -69,7 +69,7 @@ @models.permalink def get_absolute_url(self): - return ('downloads-download', [str(self.id)]) + return ('downloads-details', [str(self.id)]) def save(self, force_insert=False, force_update=False): html = render_to_string('downloads/markdown.html', {'data': self.description}) diff -r 42f22c56ab05 -r a5f27f25fa52 gpp/downloads/templatetags/downloads_tags.py --- a/gpp/downloads/templatetags/downloads_tags.py Sun Apr 19 21:01:15 2009 +0000 +++ b/gpp/downloads/templatetags/downloads_tags.py Sun Apr 19 21:16:59 2009 +0000 @@ -4,6 +4,7 @@ from django import template from downloads.forms import SearchForm +from downloads.models import Download register = template.Library() @@ -11,3 +12,10 @@ @register.inclusion_tag('downloads/navigation.html') def downloads_navigation(): return {'search_form': SearchForm()} + +@register.inclusion_tag('downloads/latest_tag.html') +def latest_downloads(): + downloads = Download.public_objects.order_by('-date_added')[:10] + return { + 'downloads': downloads, + } diff -r 42f22c56ab05 -r a5f27f25fa52 gpp/downloads/urls.py --- a/gpp/downloads/urls.py Sun Apr 19 21:01:15 2009 +0000 +++ b/gpp/downloads/urls.py Sun Apr 19 21:16:59 2009 +0000 @@ -9,7 +9,7 @@ url(r'^category/(?P\d+)/(?Ptitle|date|rating|hits)/page/(?P\d+)/$', 'category', name='downloads-category'), - url(r'^comments/(\d+)/$', 'comments', name='downloads-comments'), + url(r'^details/(\d+)/$', 'details', name='downloads-details'), url(r'^(\d+)/$', 'download', name='downloads-download'), url(r'^new/$', 'new', name='downloads-new'), url(r'^popular/$', 'popular', name='downloads-popular'), diff -r 42f22c56ab05 -r a5f27f25fa52 gpp/downloads/views.py --- a/gpp/downloads/views.py Sun Apr 19 21:01:15 2009 +0000 +++ b/gpp/downloads/views.py Sun Apr 19 21:16:59 2009 +0000 @@ -129,11 +129,11 @@ ####################################################################### @login_required -def comments(request, id): +def details(request, id): download = Download.public_objects.get(pk=id) if download is None: raise Http404 - return render_to_response('downloads/download_comments.html', { + return render_to_response('downloads/download_detail.html', { 'download' : download, }, context_instance = RequestContext(request)) diff -r 42f22c56ab05 -r a5f27f25fa52 gpp/templates/downloads/download.html --- a/gpp/templates/downloads/download.html Sun Apr 19 21:01:15 2009 +0000 +++ b/gpp/templates/downloads/download.html Sun Apr 19 21:16:59 2009 +0000 @@ -19,7 +19,7 @@ Rating:
{{ download.average_score|floatformat }}
Comments - Comments:{{ comment_count }} + Comments:{{ comment_count }} diff -r 42f22c56ab05 -r a5f27f25fa52 gpp/templates/downloads/download_comments.html --- a/gpp/templates/downloads/download_comments.html Sun Apr 19 21:01:15 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -{% extends 'base.html' %} -{% load downloads_tags %} -{% load comment_tags %} -{% load script_tags %} -{% block title %}Downloads Comments{% endblock %} -{% block custom_css %} - - -{% endblock %} -{% block custom_js %} -{% script_tags "markitup" %} - - -{% endblock %} -{% block content %} -

Downloads

-{% downloads_navigation %} -

Download Comments For {{ download.title }}

- -
-{% include 'downloads/download.html' %} -
- -{% get_comment_count for download as comment_count %} -

This download has {{ comment_count }} comment{{ comment_count|pluralize }}.

-
-{% render_comment_list download %} -{% render_comment_form for download %} -{% endblock %} diff -r 42f22c56ab05 -r a5f27f25fa52 gpp/templates/downloads/download_detail.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/downloads/download_detail.html Sun Apr 19 21:16:59 2009 +0000 @@ -0,0 +1,29 @@ +{% extends 'base.html' %} +{% load downloads_tags %} +{% load comment_tags %} +{% load script_tags %} +{% block title %}Downloads Details{% endblock %} +{% block custom_css %} + + +{% endblock %} +{% block custom_js %} +{% script_tags "markitup" %} + + +{% endblock %} +{% block content %} +

Downloads

+{% downloads_navigation %} +

Download Details For {{ download.title }}

+ +
+{% include 'downloads/download.html' %} +
+ +{% get_comment_count for download as comment_count %} +

This download has {{ comment_count }} comment{{ comment_count|pluralize }}.

+
+{% render_comment_list download %} +{% render_comment_form for download %} +{% endblock %} diff -r 42f22c56ab05 -r a5f27f25fa52 gpp/templates/downloads/latest_tag.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/downloads/latest_tag.html Sun Apr 19 21:16:59 2009 +0000 @@ -0,0 +1,10 @@ +

New Downloads

+{% if downloads %} +
    + {% for dl in downloads %} +
  1. {{ dl.title }}
  2. + {% endfor %} +
+{% else %} +

No downloads at this time.

+{% endif %} diff -r 42f22c56ab05 -r a5f27f25fa52 gpp/templates/home.html --- a/gpp/templates/home.html Sun Apr 19 21:01:15 2009 +0000 +++ b/gpp/templates/home.html Sun Apr 19 21:16:59 2009 +0000 @@ -1,5 +1,6 @@ {% extends 'base.html' %} {% load weblinks_tags %} +{% load downloads_tags %} {% block title %}Home{% endblock %} {% block content %}

Welcome to SurfGuitar101!

@@ -15,10 +16,10 @@ 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.

-
+
{% latest_weblinks %}
-
- Some more stuff. +
+ {% latest_downloads %}
{% endblock %}