changeset 139:c962f58c2693

Support photologue photo detail views to prevent 404s in the admin.
author Brian Neal <bgneal@gmail.com>
date Sat, 08 Mar 2014 13:19:10 -0600
parents fc86604ea0ad
children fbdcb7b80a16
files madeira/urls.py photologue/templates/photologue/photo_detail.html
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/madeira/urls.py	Fri Feb 14 19:42:42 2014 -0600
+++ b/madeira/urls.py	Sat Mar 08 13:19:10 2014 -0600
@@ -1,8 +1,12 @@
 from django.conf.urls import patterns, include, url
 from django.contrib import admin
+from django.contrib.admin.views.decorators import staff_member_required
 from django.conf.urls.static import static
 from django.conf import settings
-from django.views.generic import TemplateView
+from django.views.generic import DetailView, TemplateView
+
+from photologue.models import Photo
+
 
 admin.autodiscover()
 
@@ -26,6 +30,13 @@
     (r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
         'django.contrib.auth.views.password_reset_confirm'),
     (r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
+
+    # Keeping photologue on life support:
+    url(r'^photo/(?P<slug>[\-\d\w]+)/$',
+        staff_member_required(DetailView.as_view(model=Photo,
+            slug_field='title_slug')),
+        name='pl-photo'),
+
     (r'^admin/', include(admin.site.urls)),
 )
 
--- a/photologue/templates/photologue/photo_detail.html	Fri Feb 14 19:42:42 2014 -0600
+++ b/photologue/templates/photologue/photo_detail.html	Sat Mar 08 13:19:10 2014 -0600
@@ -6,7 +6,7 @@
 
 <h1>{{ object.title }}</h1>
 <div class="gallery-photo">
-    <a href="{{ object.image.url }}"><img src="{{ object.get_display_url }}" alt="{{ object.title }}"/></a>
+    <a href="{{ object.image.url }}"><img src="{{ object.image.url }}" alt="{{ object.title }}"/></a>
     {% if object.caption %}<p>{{ object.caption }}</p>{% endif %}
 </div>
 {% if object.public_galleries %}