]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blobdiff - sommitrealweird/photo/urls.py
Changes to make it work with django 1.11 and python3
[sommitrealweird.git] / sommitrealweird / photo / urls.py
index 64026ce61393d68e2b51627fd8ce5eb9b7e0b797..3e9d28c6c921179c82a6ce128098d4c685c20571 100644 (file)
@@ -1,8 +1,9 @@
-from django.conf.urls.defaults import *
-from models import Album
+from django.conf.urls import url
+from photo.models import Album
+from photo.views import AlbumListView, PhotoListView, PhotoView
 
-urlpatterns = patterns('',
-    (r'^$', 'django.views.generic.list_detail.object_list', { "paginate_by": 20, "queryset": Album.objects.all().order_by('name'), "template_name": "photo/album_index.html"}),
-    (r'^(?P<slug>[^/]*)/$', 'photo.views.album_view'),
-    (r'^(?P<slug>[^/]*)/(?P<id>[0-9]+)/$', 'photo.views.photo_view'),
-)
+urlpatterns = [
+    url(r'^$', AlbumListView.as_view()),
+    url(r'^(?P<slug>[^/]*)/$', PhotoListView.as_view()),
+    url(r'^(?P<slug>[^/]*)/(?P<id>[0-9]+)/$', PhotoView.as_view()),
+]