aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@eta.mit.edu>2009-01-25 09:52:32 -0500
committerbnewbold <bnewbold@eta.mit.edu>2009-01-25 09:52:32 -0500
commit17dd049b947cb447628002bae3068581733565f1 (patch)
tree6d91538e68cbe5e778eb3e2e73f289295aa4f7b7
parent85fec94e25e471e4bcdeeafba91deddecd69033a (diff)
downloadbnewnet-17dd049b947cb447628002bae3068581733565f1.tar.gz
bnewnet-17dd049b947cb447628002bae3068581733565f1.zip
tweaked comments form, journal starting to work
-rw-r--r--bn_django/journal/templates/journal/base.html5
-rw-r--r--bn_django/journal/templates/journal/entry_detail.html31
-rw-r--r--bn_django/journal/templates/journal/entry_list.html23
-rw-r--r--bn_django/journal/urls.py4
-rw-r--r--bn_django/photos/models.py2
-rw-r--r--bn_django/photos/urls.py8
-rw-r--r--bn_django/photos/views.py56
-rw-r--r--bn_django/templates/comments/form.html23
-rw-r--r--static/style/commentary.css24
-rw-r--r--static/style/default.css3
10 files changed, 137 insertions, 42 deletions
diff --git a/bn_django/journal/templates/journal/base.html b/bn_django/journal/templates/journal/base.html
new file mode 100644
index 0000000..819b1f4
--- /dev/null
+++ b/bn_django/journal/templates/journal/base.html
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+
+{% block path %}
+ <a href="/journal/">journal</a>
+{% endblock %}
diff --git a/bn_django/journal/templates/journal/entry_detail.html b/bn_django/journal/templates/journal/entry_detail.html
new file mode 100644
index 0000000..45edd4b
--- /dev/null
+++ b/bn_django/journal/templates/journal/entry_detail.html
@@ -0,0 +1,31 @@
+{% extends "journal/base.html" %}
+{# {% load markup %} #}
+{% load comments %}
+{% block path %}{{ block.super }}
+ &raquo;<a href="../{{ object.slug }}"> {{ object.title }}</a>
+{% endblock %}
+
+{% block title %}
+{% if object.title %}{{ object.title }}{% else %}[Untitled Entry]{% endif %}
+{% endblock %}
+
+{% block content %}<br />
+{% if object %}<div class="right_stuff">
+<p class="date">Entry dated {{ object.date }},
+{% if object.author %}<br />written by {{ object.author }},{% endif %}
+{% if object.last_edited %}<br />last edited {{ object.last_edited }}.{% endif %}
+</div>
+<p class="journal_entry">{{ object.html_content|safe }}</p>
+{% else %}
+<p>This is not the entry you are looking for.</p>
+{% endif %}
+{% endblock %}
+
+{% block commentary %}
+<div class='content' id='commentary'>
+<h3>Post a comment</h3>
+{% render_comment_form for object %}
+{% get_comment_list for object as comments %}
+{% include "comment_list" %}
+</div>
+{% endblock %}
diff --git a/bn_django/journal/templates/journal/entry_list.html b/bn_django/journal/templates/journal/entry_list.html
new file mode 100644
index 0000000..f103c4e
--- /dev/null
+++ b/bn_django/journal/templates/journal/entry_list.html
@@ -0,0 +1,23 @@
+{% extends "journal/base.html" %}
+{# {% load markup %} #}
+
+{% block title %}Journal Entries{% endblock %}
+
+{% block content %}
+<br />
+{% if object_list %}
+<ul>
+ {% for item in object_list %}
+ <li /><a href="{{ item.slug }}/">{{item.title}}
+ {% endfor %}
+</ul>
+{% else %}
+<p>No entries have been entered yet.</p>
+{% endif %}
+
+{% if is_paginated %} {% if has_previous %}
+<a href="./?page={{ previous }}">&laquo; previous</a> |
+{% endif %} {% if has_next %}
+<a href="./?page={{ next }}">next &raquo;</a>
+{% endif %} {% endif %}
+{% endblock %}
diff --git a/bn_django/journal/urls.py b/bn_django/journal/urls.py
index d65d52a..1730ac7 100644
--- a/bn_django/journal/urls.py
+++ b/bn_django/journal/urls.py
@@ -7,6 +7,6 @@ urlpatterns = patterns('django.views.generic.list_detail',
(r'^$', 'object_list',
dict(queryset=Entry.objects.order_by('-date'),
paginate_by=35, allow_empty=False)),
- (r'^(?P<slug>)/$', 'object_detail',
- dict(info_dict, queryset=Entry.objects.all(), slug_field='slug')),
+ (r'^(?P<slug>[\d\w-]+)/$', 'object_detail',
+ dict(queryset=Entry.objects.all(), slug_field='slug')),
)
diff --git a/bn_django/photos/models.py b/bn_django/photos/models.py
index 73d09e9..3d47cf0 100644
--- a/bn_django/photos/models.py
+++ b/bn_django/photos/models.py
@@ -82,7 +82,7 @@ class Photo(models.Model):
title = models.CharField("title", max_length=80)
desc = models.TextField("description", blank=True)
gallery = models.ForeignKey(Gallery)
- photographer = models.CharField("photographer"), max_length=80,
+ photographer = models.CharField("photographer", max_length=80,
blank=True)
date = models.DateField("date photographed", blank=True, null=True)
extra = models.TextField("any extra information about the photo",
diff --git a/bn_django/photos/urls.py b/bn_django/photos/urls.py
index 6c7fc19..f50a97b 100644
--- a/bn_django/photos/urls.py
+++ b/bn_django/photos/urls.py
@@ -17,7 +17,7 @@ urlpatterns = patterns('django.views.generic.list_detail',
(r'^detail/(?P<object_id>\d+)/$', 'object_detail',
dict(info_dict, queryset=Photo.objects.all())),
)
-urlpatterns += patterns('bn_django.photos.views',
- (r'^import/(\d+)/$', 'import_photos'),
- (r'^export/(\d+)/$', 'export'),
-)
+#urlpatterns += patterns('bn_django.photos.views',
+ #(r'^import/(\d+)/$', 'import_photos'),
+ #(r'^export/(\d+)/$', 'export'),
+#)
diff --git a/bn_django/photos/views.py b/bn_django/photos/views.py
index 7cc5332..bc8a3a4 100644
--- a/bn_django/photos/views.py
+++ b/bn_django/photos/views.py
@@ -126,31 +126,31 @@ def import_photos(request, thegallery):
dict(form=form, gallery=gallery))
# request,
-@login_required
-def export(request, thegallery):
- """Export a gallery to a zip file and send it to the user.
- """
- # Check if the gallery is valid
- gallery = get_object_or_404(Gallery, pk=thegallery)
-
- # gather up the photos into a new directory
- tmpdir = mkdtemp()
- for photo in gallery.photo_set.all():
- shutil.copy(photo.get_image_filename(),
- tmpdir)
- files = [ os.path.join(tmpdir, ff) for ff in os.listdir(tmpdir) ]
- outfile = NamedTemporaryFile()
- zf = zipfile.ZipFile(outfile, "w",
- compression=zipfile.ZIP_DEFLATED)
- for filename in files:
- zf.write(filename, arcname=os.path.basename(filename))
- zf.close()
- outfile.flush()
- outfile.seek(0)
- shutil.rmtree(tmpdir)
- response = HttpResponse(outfile)
- response['Content-Type'] = "application/zip"
- response['Content-Length'] = str(os.stat(outfile.name)[stat.ST_SIZE])
- response['Content-Disposition'] = "attachment; filename=photos.zip"
- return response
-
+#@login_required
+#def export(request, thegallery):
+ #"""Export a gallery to a zip file and send it to the user.
+ #"""
+ ## Check if the gallery is valid
+ #gallery = get_object_or_404(Gallery, pk=thegallery)
+ #
+ ## gather up the photos into a new directory
+ #tmpdir = mkdtemp()
+ #for photo in gallery.photo_set.all():
+ #shutil.copy(photo.get_image_filename(),
+ #tmpdir)
+ #files = [ os.path.join(tmpdir, ff) for ff in os.listdir(tmpdir) ]
+ #outfile = NamedTemporaryFile()
+ #zf = zipfile.ZipFile(outfile, "w",
+ #compression=zipfile.ZIP_DEFLATED)
+ #for filename in files:
+ #zf.write(filename, arcname=os.path.basename(filename))
+ #zf.close()
+ ##outfile.flush()
+ #outfile.seek(0)
+ #shutil.rmtree(tmpdir)
+ #response = HttpResponse(outfile)
+ #response['Content-Type'] = "application/zip"
+ #response['Content-Length'] = str(os.stat(outfile.name)[stat.ST_SIZE])
+ #response['Content-Disposition'] = "attachment; filename=photos.zip"
+ #return response
+ #
diff --git a/bn_django/templates/comments/form.html b/bn_django/templates/comments/form.html
new file mode 100644
index 0000000..67068e8
--- /dev/null
+++ b/bn_django/templates/comments/form.html
@@ -0,0 +1,23 @@
+{% load comments i18n %}
+<form action="{% comment_form_target %}" method="post">
+<table>
+ {% for field in form %}
+ {% if field.is_hidden %} {{ field }} {% else %}
+ {% ifequal field.name "honeypot" %}
+ <span style="display:none;">{{ field.label_tag }}{{ field }}</span>
+ {% else %}
+
+<tr><td class="comment_field_name">
+ <span {% if field.errors %} class="error"{% endif %}>
+ {% if field.errors %}{{ field.errors }}{% endif %}
+ {{ field.label_tag }}</span></td><td>{{ field }}
+</td></tr>
+ {% endifequal %}
+ {% endif %}
+ {% endfor %}
+<tr><td class="comment_field_name"></td><td>
+ <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" />
+ <input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" />
+</td></tr>
+</table>
+</form>
diff --git a/static/style/commentary.css b/static/style/commentary.css
index 584e6f1..a65eb76 100644
--- a/static/style/commentary.css
+++ b/static/style/commentary.css
@@ -11,7 +11,7 @@
#commentary hr {
border-color: #b7c6ff; }
#commentary form textarea {
- width: 640px;
+ width: 520px;
padding: 2px;
border: 1px solid black;
height: 120px; }
@@ -20,12 +20,24 @@
border: 1px solid black;
margin-top: 3px;
}
-#commentary form input.submit {
- margin-top: 4px;
- margin-right: 19px;
- float: right;
+#commentary form input.submit-post {
border: 1px solid black;
- width: 180px; }
+ width: 110px;
+ background-color: gold;
+ margin-right: 10px;
+ margin-top: 0px; }
+#commentary form input.submit-preview {
+ border: 1px solid black;
+ width: 110px;
+ background-color: greenyellow;
+ margin-top: 0px; }
+
+#commentary form td.comment_field_name {
+ width: 250px;
+ vertical-align: top;
+ padding-top: 7px;
+ padding-right: 7px;
+ text-align: right; }
#commentary table {
width: 93%;
diff --git a/static/style/default.css b/static/style/default.css
index c0f540c..acdd415 100644
--- a/static/style/default.css
+++ b/static/style/default.css
@@ -1,6 +1,7 @@
html {
margin: 0px;
- padding: 0px; }
+ padding: 0px;
+ font-size: 16px; }
body {
font-family: serif;
margin: 0px;