diff options
author | Bryan Newbold <bnewbold@animus.robocracy.org> | 2008-09-23 18:52:55 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@animus.robocracy.org> | 2008-09-23 18:52:55 -0700 |
commit | 979f5901af8410ff138de0aa41013bfb193060d6 (patch) | |
tree | f3c59f2a2f1da90e13336e16efa4b48003534052 /bn_django | |
parent | 6a22baa306a72557698d64ac6c09842bed81f66b (diff) | |
download | bnewnet-979f5901af8410ff138de0aa41013bfb193060d6.tar.gz bnewnet-979f5901af8410ff138de0aa41013bfb193060d6.zip |
1.0
Diffstat (limited to 'bn_django')
-rw-r--r-- | bn_django/git_wiki/views.py | 5 | ||||
-rw-r--r-- | bn_django/photos/templates/photos/photo_detail.html | 14 | ||||
-rw-r--r-- | bn_django/templates/comments/form.html | 36 | ||||
-rw-r--r-- | bn_django/templates/comments/free_preview.html | 46 | ||||
-rw-r--r-- | bn_django/templates/comments/freeform.html | 10 | ||||
-rw-r--r-- | bn_django/templates/comments/posted.html | 13 | ||||
-rw-r--r-- | bn_django/templates/comments/preview.html | 46 | ||||
-rw-r--r-- | bn_django/templates/newcomments_table | 16 | ||||
-rw-r--r-- | bn_django/urls.py | 14 |
9 files changed, 14 insertions, 186 deletions
diff --git a/bn_django/git_wiki/views.py b/bn_django/git_wiki/views.py index 58d4194..f16ea84 100644 --- a/bn_django/git_wiki/views.py +++ b/bn_django/git_wiki/views.py @@ -7,7 +7,7 @@ import os, commands from models import * from settings import * -from django.contrib.comments.models import Comment,FreeComment +from django.contrib.comments.models import Comment # Create your views here. @@ -16,10 +16,9 @@ def frontpage(request): t.update() #TODO: doesn't display free comments unless there's a comment lc = Comment.objects.filter(content_type__name="item").order_by('-submit_date')[:6] - lfc = FreeComment.objects.filter(content_type__name="item").order_by('-submit_date')[:6] return render_to_response('git_wiki/frontpage.html', \ dict(shortlog=shortlog(), tree=t, - latest_comments=lc, latest_freecomments=lfc, + latest_comments=lc, newitems=newest_items())) def tree(request, reqslug, tree=None): diff --git a/bn_django/photos/templates/photos/photo_detail.html b/bn_django/photos/templates/photos/photo_detail.html index 5d02710..1278bda 100644 --- a/bn_django/photos/templates/photos/photo_detail.html +++ b/bn_django/photos/templates/photos/photo_detail.html @@ -1,5 +1,6 @@ {% extends "photos/base.html" %} {# {% load markup %} #} + {% load comments %} {% block path %} @@ -101,17 +102,10 @@ by {{ object.photographer }}.</p> {% endblock %} {% block commentary %} -<div class="content" id="commentary"> -{% load comments %} +<div class='content' id='commentary'> <h3>Post a comment</h3> -{% if user.is_authenticated %} -{% comment_form for photos.photo object.id with is_public true %} -{% else %} -{% free_comment_form for photos.photo object.id with is_public true %} -{% endif %} -<br /> -{% get_comment_list for photos.photo object.id as comments %} -{% get_free_comment_list for photos.photo object.id as free_comments %} +{% render_comment_form for object %} +{% get_comment_list for object as comments %} {% include "comment_list" %} </div> {% endblock %} diff --git a/bn_django/templates/comments/form.html b/bn_django/templates/comments/form.html deleted file mode 100644 index a2af1be..0000000 --- a/bn_django/templates/comments/form.html +++ /dev/null @@ -1,36 +0,0 @@ -{% load i18n %} -<form {% if photos_optional or photos_required %}enctype="multipart/form-data" {% endif %}action="/comments/post/" method="post"> - -<p><textarea name="comment" id="id_comment"></textarea></p> -<input class="submit" type="submit" name="preview" value="{% trans "Preview comment" %}" /> -{% if user.is_authenticated %} -<p> {% trans "Username:" %} <strong>{{ user.username }}</strong> (<a href="/accounts/logout/">{% trans "Log out" %}</a>) -{% else %} -<p><label for="id_username">{% trans "Username:" %}</label> <input type="text" name="username" id="id_username" /><br />{% trans "Password:" %} <input type="password" name="password" id="id_password" /> (<a href="/accounts/password_reset/">{% trans "Forgotten your password?" %}</a>) -{% endif %} -</p> - -{% if ratings_optional or ratings_required %} -<p>{% trans "Ratings" %} ({% if ratings_required %}{% trans "Required" %}{% else %}{% trans "Optional" %}{% endif %}):</p> -<table> -<tr><th> </th>{% for value in rating_range %}<th>{{ value }}</th>{% endfor %}</tr> -{% for rating in rating_choices %} -<tr><th>{{ rating }}</th>{% for value in rating_range %}<th><input type="radio" name="rating{{ forloop.parentloop.counter }}" value="{{ value }}" /></th>{% endfor %}</tr> -{% endfor %} -</table> -<input type="hidden" name="rating_options" value="{{ rating_options }}" /> -{% endif %} - -{% if photos_optional or photos_required %} -<p><label for="id_photo">{% trans "Post a photo" %}</label> ({% if photos_required %}{% trans "Required" %}{% else %}{% trans "Optional" %}{% endif %}): -<input type="file" name="photo" id="id_photo" /></p> -<input type="hidden" name="photo_options" value="{{ photo_options }}" /> -{% endif %} - - -<p> -<input type="hidden" name="options" value="{{ options }}" /> -<input type="hidden" name="target" value="{{ target }}" /> -<input type="hidden" name="gonzo" value="{{ hash }}" /> -</p> -</form> diff --git a/bn_django/templates/comments/free_preview.html b/bn_django/templates/comments/free_preview.html deleted file mode 100644 index 3c212c0..0000000 --- a/bn_django/templates/comments/free_preview.html +++ /dev/null @@ -1,46 +0,0 @@ -{% extends "base.html" %} - - -{% block title %}Preview your comment{% endblock %} - -{% block content %} - -<form action="../postfree/" method="post"> - {% if comment_form.has_errors %} - <p><strong style="color: red;">Please correct the following errors.</strong></p> - {% else %} - <div class="comment"> - {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }} - <p class="date small">Posted by <strong>{{ comment.person_name }}</strong></p> - </div> - - <p><input type="submit" name="post" value="Post public comment" /></p> - - <h1>Or edit it again</h1> - {% endif %} - - {% if comment_form.person_name.errors %} - {{ comment_form.person_name.html_error_list }} - {% endif %} - - <p><label for="id_person_name">Your name:</label> {{ comment_form.person_name }}</p> - - {% if comment_form.comment.errors %} - {{ comment_form.comment.error_list }} - {% endif %} - - <p> - <label for="id_comment">Comment:</label> - <br /> - {{ comment_form.comment }} - </p> - - <input type="hidden" name="options" value="{{ options }}" /> - <input type="hidden" name="target" value="{{ target }}" /> - <input type="hidden" name="gonzo" value="{{ hash }}" /> - - <p> - <input type="submit" name="preview" value="Preview revised comment" /> - </p> -</form> -{% endblock %} diff --git a/bn_django/templates/comments/freeform.html b/bn_django/templates/comments/freeform.html deleted file mode 100644 index 3d3678e..0000000 --- a/bn_django/templates/comments/freeform.html +++ /dev/null @@ -1,10 +0,0 @@ -{% load i18n %} -<form action="/comments/postfree/" method="post"> -<p><textarea name="comment" id="id_comment" rows="10" cols="60"></textarea></p> -<input class="submit" type="submit" name="preview" value="{% trans "Preview comment" %}" /> -<p> <label for="id_person_name">{% trans "Your name:" %}</label> <input type="text" id="id_person_name" name="person_name" /> -<input type="hidden" name="options" value="{{ options }}" /> -<input type="hidden" name="target" value="{{ target }}" /> -<input type="hidden" name="gonzo" value="{{ hash }}" /> -</p> -</form> diff --git a/bn_django/templates/comments/posted.html b/bn_django/templates/comments/posted.html deleted file mode 100644 index 07bdb67..0000000 --- a/bn_django/templates/comments/posted.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Comment posted successfully{% endblock %} - -{% block content %} -<p>Thanks for contributing.</p> - -{% if object %} - <ul> - <li><a href="{{ object.get_absolute_url }}">View your comment</a></li> - </ul> -{% endif %} -{% endblock %} diff --git a/bn_django/templates/comments/preview.html b/bn_django/templates/comments/preview.html deleted file mode 100644 index 052b373..0000000 --- a/bn_django/templates/comments/preview.html +++ /dev/null @@ -1,46 +0,0 @@ -{% extends "base.html" %} - - -{% block title %}Preview your comment{% endblock %} - -{% block content %} - -<form action="../post/" method="post"> - {% if comment_form.has_errors %} - <p><strong style="color: red;">Please correct the following errors.</strong></p> - {% else %} - <div class="comment"> - {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }} - <p class="date small">Posted by <strong>{{ comment.person_name }}</strong></p> - </div> - - <p><input type="submit" name="post" value="Post public comment" /></p> - - <h1>Or edit it again</h1> - {% endif %} - - {% if comment_form.person_name.errors %} - {{ comment_form.person_name.html_error_list }} - {% endif %} - - <p><label for="id_person_name">Your name:</label> {{ comment_form.person_name }}</p> - - {% if comment_form.comment.errors %} - {{ comment_form.comment.html_error_list }} - {% endif %} - - <p> - <label for="id_comment">Comment:</label> - <br /> - {{ comment_form.comment }} - </p> - - <input type="hidden" name="options" value="{{ options }}" /> - <input type="hidden" name="target" value="{{ target }}" /> - <input type="hidden" name="gonzo" value="{{ hash }}" /> - - <p> - <input type="submit" name="preview" value="Preview revised comment" /> - </p> -</form> -{% endblock %} diff --git a/bn_django/templates/newcomments_table b/bn_django/templates/newcomments_table index 6c38d10..ab50b7c 100644 --- a/bn_django/templates/newcomments_table +++ b/bn_django/templates/newcomments_table @@ -5,21 +5,9 @@ {{ c.submit_date|date:"F jS" }}</td> <td class="description"> {% if c.user.username %}{{ c.user.username }} - {% else %}anonymous{% endif%} </td> + {% else %}c.user_name{% endif%} </td> <td class="description"> - <a href="{{c.get_content_object.get_absolute_url}}"> - {{ c.content_type.name }}</a></td> - </tr> -{% endfor %} -{% for c in latest_freecomments %} -<tr> - <td class="date"> - {{ c.submit_date|date:"F jS" }}</td> - <td class="description"> - {% if c.person_name %}{{c.person_name}}{% else %}anonymous{% endif %} - </td> - <td class="description"> - <a href="{{c.get_content_object.get_absolute_url}}"> + <a href="{{c.get_content_object_url}}"> {{ c.content_type.name }}</a></td> </tr> {% endfor %} diff --git a/bn_django/urls.py b/bn_django/urls.py index f37eca0..fa8b083 100644 --- a/bn_django/urls.py +++ b/bn_django/urls.py @@ -1,6 +1,6 @@ from django.conf.urls.defaults import * from photos.models import Photo -from django.contrib.comments.models import Comment,FreeComment +from django.contrib.comments.models import Comment from django.contrib import admin import git_wiki.models @@ -14,9 +14,7 @@ urlpatterns = patterns('', 'latest_photos':Photo.objects.order_by('-date')[:2], \ #'latest_comments':Photo.objects.order_by('date')[:4] \ 'latest_knowledge':git_wiki.models.shortlog(), \ - 'latest_comments':Comment.objects.order_by('-submit_date')[:4], \ - 'latest_freecomments': \ - FreeComment.objects.order_by('-submit_date')[:4], \ + 'latest_comments':Comment.objects.order_by('-submit_date')[:8], \ 'newitems':git_wiki.models.newest_items(), \ })}), (r'^about/$', 'django.views.generic.simple.direct_to_template', @@ -35,12 +33,12 @@ urlpatterns = patterns('', #(r'^code/', include('bn_django.git_browse.urls')), (r'^photos/', include('bn_django.photos.urls')), - (r'^search/', include('bn_django.search.urls')), + #(r'^search/', include('bn_django.search.urls')), # Uncomment this for admin: - (r'^admin/doc/', include('django.contrib.admindocs.urls')), - (r'^admin/(.*)', admin.site.root), - (r'^comments/', include('django.contrib.comments.urls.comments')), + (r'^admin/doc/', include('django.contrib.admindocs.urls')), + (r'^admin/(.*)', admin.site.root), + (r'^comments/', include('django.contrib.comments.urls')), (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/static', |