# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # $Id$ # ---------------------------------------------------------------------------- # # Copyright (c) 2008 Guilherme Mesquita Gondim # # This file is part of django-fleshin. # # django-fleshin is free software under terms of the GNU General # Public License version 3 (GPLv3) as published by the Free Software # Foundation. See the file README for copying conditions. # """ URL definitions for photos and albums. """ from django.conf.urls.defaults import * from fleshin.models import Photo, Album from fleshin.settings import FLESHIN_NUM_LATEST photo_info_dict = { 'queryset': Photo.published_on_site.all(), 'template_object_name': 'photo', } photo_detail = url( regex = '^[-\w]+/(?P[-\w]+)/$', view = 'django.views.generic.list_detail.object_detail', kwargs = dict(photo_info_dict, slug_field='slug'), name = 'fleshin-photo' ) photo_list = url( # all photos + album list regex = '^$', view = 'django.views.generic.list_detail.object_list', kwargs = dict(photo_info_dict, paginate_by=FLESHIN_NUM_LATEST, extra_context={'album_list': Album.objects.all}), name = 'fleshin-photo-list' ) photo_album_list = url( # only photos in ``album`` regex = '^(?P[-\w]+)/$', view = 'fleshin.views.photo_list', kwargs = dict(photo_info_dict, paginate_by=FLESHIN_NUM_LATEST), name = 'fleshin-photo-album-list' ) urlpatterns = patterns('', photo_detail, photo_list, photo_album_list)