summaryrefslogtreecommitdiff
path: root/app/photos/admin.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/photos/admin.py')
-rw-r--r--app/photos/admin.py42
1 files changed, 5 insertions, 37 deletions
diff --git a/app/photos/admin.py b/app/photos/admin.py
index dbcca64..b247bff 100644
--- a/app/photos/admin.py
+++ b/app/photos/admin.py
@@ -3,7 +3,7 @@ from django.contrib.gis.admin import OSMGeoAdmin
from django.conf.urls import patterns
from django.conf.urls import url
from django.utils.translation import ungettext, ugettext_lazy as _
-from photos.models import Photo, PhotoGallery, LuxImage, Gallery
+from photos.models import Photo, PhotoGallery, LuxImage, LuxGallery
from django.shortcuts import render
from django.contrib.admin import helpers
from django.http import HttpResponseRedirect
@@ -20,15 +20,15 @@ class LuxImageAdmin(OSMGeoAdmin):
admin.site.register(LuxImage, LuxImageAdmin)
-class GalleryAdmin(OSMGeoAdmin):
+class LuxGalleryAdmin(OSMGeoAdmin):
list_display = ('title', 'location', 'pub_date')
list_filter = ('location',)
def get_urls(self):
- urls = super(GalleryAdmin, self).get_urls()
+ urls = super(LuxGalleryAdmin, self).get_urls()
custom_urls = [
url(
- r'^upload_zip/$',
+ r'upload_zip/$',
self.admin_site.admin_view(self.upload_zip),
name='upload_zip'
)
@@ -57,7 +57,7 @@ class GalleryAdmin(OSMGeoAdmin):
{})
return render(request, 'admin/upload_zip.html', context)
-admin.site.register(Gallery, GalleryAdmin)
+admin.site.register(LuxGallery, LuxGalleryAdmin)
class PhotoAdmin(OSMGeoAdmin):
@@ -131,37 +131,5 @@ class PhotoGalleryAdmin(OSMGeoAdmin):
}),
)
- def get_urls(self):
- urls = super(PhotoGalleryAdmin, self).get_urls()
- custom_urls = [
- url(
- r'^upload_zip/$',
- self.admin_site.admin_view(self.upload_zip),
- name='upload_zip'
- )
- ]
- return custom_urls + urls
-
- def upload_zip(self, request):
- context = {
- 'title': _('Upload a zip archive of photos'),
- 'app_label': self.model._meta.app_label,
- 'opts': self.model._meta,
- 'has_change_permission': self.has_change_permission(request)
- }
-
- # Handle form request
- if request.method == 'POST':
- form = UploadZipForm(request.POST, request.FILES)
- if form.is_valid():
- form.save(request=request)
- return HttpResponseRedirect('..')
- else:
- form = UploadZipForm()
- context['form'] = form
- context['adminform'] = helpers.AdminForm(form,
- list([(None, {'fields': form.base_fields})]),
- {})
- return render(request, 'admin/upload_zip.html', context)
admin.site.register(PhotoGallery, PhotoGalleryAdmin)