bgneal@1
|
1 from django.conf import settings
|
bgneal@66
|
2 from django.conf.urls import *
|
bgneal@1
|
3 from models import *
|
bgneal@1
|
4
|
bgneal@1
|
5 # Number of random images from the gallery to display.
|
bgneal@1
|
6 SAMPLE_SIZE = ":%s" % getattr(settings, 'GALLERY_SAMPLE_SIZE', 5)
|
bgneal@1
|
7
|
bgneal@1
|
8 # galleries
|
bgneal@1
|
9 gallery_args = {'date_field': 'date_added', 'allow_empty': True, 'queryset': Gallery.objects.filter(is_public=True), 'extra_context':{'sample_size':SAMPLE_SIZE}}
|
bgneal@1
|
10 urlpatterns = patterns('django.views.generic.date_based',
|
bgneal@1
|
11 url(r'^gallery/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\-\d\w]+)/$', 'object_detail', {'date_field': 'date_added', 'slug_field': 'title_slug', 'queryset': Gallery.objects.filter(is_public=True), 'extra_context':{'sample_size':SAMPLE_SIZE}}, name='pl-gallery-detail'),
|
bgneal@1
|
12 url(r'^gallery/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', gallery_args, name='pl-gallery-archive-day'),
|
bgneal@1
|
13 url(r'^gallery/(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', gallery_args, name='pl-gallery-archive-month'),
|
bgneal@1
|
14 url(r'^gallery/(?P<year>\d{4})/$', 'archive_year', gallery_args, name='pl-gallery-archive-year'),
|
bgneal@1
|
15 url(r'^gallery/?$', 'archive_index', gallery_args, name='pl-gallery-archive'),
|
bgneal@1
|
16 )
|
bgneal@1
|
17 urlpatterns += patterns('django.views.generic.list_detail',
|
bgneal@1
|
18 url(r'^gallery/(?P<slug>[\-\d\w]+)/$', 'object_detail', {'slug_field': 'title_slug', 'queryset': Gallery.objects.filter(is_public=True), 'extra_context':{'sample_size':SAMPLE_SIZE}}, name='pl-gallery'),
|
bgneal@1
|
19 url(r'^gallery/page/(?P<page>[0-9]+)/$', 'object_list', {'queryset': Gallery.objects.filter(is_public=True), 'allow_empty': True, 'paginate_by': 5, 'extra_context':{'sample_size':SAMPLE_SIZE}}, name='pl-gallery-list'),
|
bgneal@1
|
20 )
|
bgneal@1
|
21
|
bgneal@1
|
22 # photographs
|
bgneal@1
|
23 photo_args = {'date_field': 'date_added', 'allow_empty': True, 'queryset': Photo.objects.filter(is_public=True)}
|
bgneal@1
|
24 urlpatterns += patterns('django.views.generic.date_based',
|
bgneal@1
|
25 url(r'^photo/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\-\d\w]+)/$', 'object_detail', {'date_field': 'date_added', 'slug_field': 'title_slug', 'queryset': Photo.objects.filter(is_public=True)}, name='pl-photo-detail'),
|
bgneal@1
|
26 url(r'^photo/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', photo_args, name='pl-photo-archive-day'),
|
bgneal@1
|
27 url(r'^photo/(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', photo_args, name='pl-photo-archive-month'),
|
bgneal@1
|
28 url(r'^photo/(?P<year>\d{4})/$', 'archive_year', photo_args, name='pl-photo-archive-year'),
|
bgneal@1
|
29 url(r'^photo/$', 'archive_index', photo_args, name='pl-photo-archive'),
|
bgneal@1
|
30 )
|
bgneal@1
|
31 urlpatterns += patterns('django.views.generic.list_detail',
|
bgneal@1
|
32 url(r'^photo/(?P<slug>[\-\d\w]+)/$', 'object_detail', {'slug_field': 'title_slug', 'queryset': Photo.objects.filter(is_public=True)}, name='pl-photo'),
|
bgneal@1
|
33 url(r'^photo/page/(?P<page>[0-9]+)/$', 'object_list', {'queryset': Photo.objects.filter(is_public=True), 'allow_empty': True, 'paginate_by': 20}, name='pl-photo-list'),
|
bgneal@1
|
34 )
|
bgneal@1
|
35
|
bgneal@1
|
36
|