My favorites | Sign in
Project Logo
                
Changes to /trunk/fleshin/urls/photos.py
r0 vs. r3   Edit
  Compare: vs.   Format:
Revision r3
Go to: 
Project members, sign in to write a code review
/trunk/fleshin/urls/photos.py   r0 /trunk/fleshin/urls/photos.py   r3
Properties
 svn:eol-style
   1 native
  
 svn:keywords
   1 Date Revision Author HeadURL Id
  
Contents
  1 # -*- coding: utf-8 -*-
  2 # ----------------------------------------------------------------------------
  3 # $Id$
  4 # ----------------------------------------------------------------------------
  5 #
  6 # Copyright (c) 2008 Guilherme Mesquita Gondim
  7 #
  8 # This file is part of django-fleshin.
  9 #
  10 # django-fleshin is free software under terms of the GNU General
  11 # Public License version 3 (GPLv3) as published by the Free Software
  12 # Foundation. See the file README for copying conditions.
  13 #
  14
  15 """
  16 URL definitions for photos and albums.
  17 """
  18
  19 from django.conf.urls.defaults import *
  20 from fleshin.models import Photo, Album
  21 from fleshin.settings import FLESHIN_NUM_LATEST
  22
  23 photo_info_dict = {
  24 'queryset': Photo.published_on_site.all(),
  25 'template_object_name': 'photo',
  26 }
  27 album_info_dict = {
  28 'queryset': Album.objects.all(),
  29 'template_object_name': 'album',
  30 }
  31
  32 photo_detail = url(
  33 regex = '^(?P<album>[-\w]+)/(?P<slug>[-\w]+)/$',
  34 view = 'fleshin.views.photo_detail',
  35 kwargs = dict(photo_info_dict, slug_field='slug'),
  36 name = 'fleshin-photo'
  37 )
  38 photo_list = url( # all photos + album list
  39 regex = '^$',
  40 view = 'django.views.generic.list_detail.object_list',
  41 kwargs = dict(photo_info_dict, extra_context={'album_list': Album.objects.all}),
  42 name = 'fleshin-photo-list'
  43 )
  44 photo_album_list = url( # only photos in ``album``
  45 regex = '^(?P<album>[-\w]+)/$',
  46 view = 'fleshin.views.photo_list',
  47 kwargs = dict(photo_info_dict, paginate_by=FLESHIN_NUM_LATEST)
  48 name = 'fleshin-photo-album-list'
  49 )
  50 album_detail = url(
  51 regex = '^(?P<slug>[-\w]+)/$',
  52 view = 'django.views.generic.list_detail.object_detail',
  53 kwargs = dict(album_info_dict, slug_field='slug'),
  54 name = 'fleshin-album'
  55 )
  56
  57 urlpatterns = patterns('', photo_detail, photo_list, photo_album_list,
  58 album_detail)
Hosted by Google Code