aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django
diff options
context:
space:
mode:
Diffstat (limited to 'bn_django')
-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
8 files changed, 117 insertions, 35 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>