aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django/photos
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 /bn_django/photos
parent85fec94e25e471e4bcdeeafba91deddecd69033a (diff)
downloadbnewnet-17dd049b947cb447628002bae3068581733565f1.tar.gz
bnewnet-17dd049b947cb447628002bae3068581733565f1.zip
tweaked comments form, journal starting to work
Diffstat (limited to 'bn_django/photos')
-rw-r--r--bn_django/photos/models.py2
-rw-r--r--bn_django/photos/urls.py8
-rw-r--r--bn_django/photos/views.py56
3 files changed, 33 insertions, 33 deletions
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
+ #