summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2018-02-05 09:22:00 -0600
committerluxagraf <sng@luxagraf.net>2018-02-05 09:22:00 -0600
commit4b2df9841a0cfd7e5630162d81c4c8369cf3ba0a (patch)
treeee0ab3dd29bb6a278745b35704bfacdbdce6191e /app
parent7109f9d3b7ec1cd445919fca1e320c9757f30edb (diff)
moved most of my admin customizations into javascript to avoid
customizing admin files
Diffstat (limited to 'app')
-rw-r--r--app/jrnl/admin.py2
-rw-r--r--app/photos/admin.py3
-rw-r--r--app/photos/urls.py5
-rw-r--r--app/photos/views.py8
4 files changed, 16 insertions, 2 deletions
diff --git a/app/jrnl/admin.py b/app/jrnl/admin.py
index 1f0a14b..5fcdc89 100644
--- a/app/jrnl/admin.py
+++ b/app/jrnl/admin.py
@@ -64,7 +64,7 @@ class EntryAdmin(OSMGeoAdmin):
openlayers_url = '/static/admin/js/OpenLayers.js'
class Media:
- js = ('image-loader.js',)
+ js = ('image-loader.js','next-prev-links.js')
@admin.register(HomepageCurrator)
class HomepageCurratorAdmin(admin.ModelAdmin):
diff --git a/app/photos/admin.py b/app/photos/admin.py
index b69897a..d0f28d7 100644
--- a/app/photos/admin.py
+++ b/app/photos/admin.py
@@ -51,6 +51,9 @@ class LuxImageAdmin(OSMGeoAdmin):
}),
)
+ class Media:
+ js = ('image-preview.js','next-prev-links.js')
+
admin.site.register(LuxImage, LuxImageAdmin)
diff --git a/app/photos/urls.py b/app/photos/urls.py
index 5978107..7be732d 100644
--- a/app/photos/urls.py
+++ b/app/photos/urls.py
@@ -11,6 +11,11 @@ urlpatterns = [
views.photo_json
),
url(
+ r'data/admin/preview/(?P<pk>\d+)/$',
+ views.photo_preview_json,
+ name="admin_image_preview"
+ ),
+ url(
r'galleries/private/(?P<slug>[-\w]+)$',
views.PrivateGallery.as_view(),
name="private"
diff --git a/app/photos/views.py b/app/photos/views.py
index bb94fbe..0a7e256 100644
--- a/app/photos/views.py
+++ b/app/photos/views.py
@@ -3,7 +3,7 @@ from django.template import RequestContext
from django.http import Http404, HttpResponse
from django.core import serializers
-from photos.models import Photo, PhotoGallery, LuxGallery
+from .models import Photo, PhotoGallery, LuxGallery, LuxImage
from locations.models import Country, Region
from utils.views import PaginatedListView
@@ -70,6 +70,12 @@ def photo_json(request, slug):
return HttpResponse(serializers.serialize('json', p), mimetype='application/json')
+def photo_preview_json(request, pk):
+ p = LuxImage.objects.get(pk=pk)
+ url = p.get_admin_image()
+ return HttpResponse(url)
+
+
def gallery_list_by_area(request, slug, page):
"""Grabs entries by region or country"""
request.page_url = '/photos/' + slug + '/%d/'