X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fema.git;a=blobdiff_plain;f=urls.py;h=22476cb9035d5c2a1b2cfabddae9c3fcfa10cafb;hp=19c2a132d870d0d2b5ddef9d6b6a7f1ccc29fae8;hb=8766cb759308106a220d54154220dbdc4c813321;hpb=7196737d39e85c1799e2ee3c4fe0b9ca6d9b45bf diff --git a/urls.py b/urls.py index 19c2a13..22476cb 100644 --- a/urls.py +++ b/urls.py @@ -1,5 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2008 Lincoln de Sousa +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. from django.conf.urls.defaults import * +from django.conf import settings +from diario.settings import DIARIO_NUM_LATEST +from diario.models import Entry +from contents.models import Menu + +MEDIA = {'document_root': settings.INSTANCE('media')} + +# the only difference between info_dict and info_dict_full is that the +# full version contains all entries and the other has just entries +# without menus. + +hasmenu = [x.entry.id for x in Menu.objects.all()] +info_dict = { + 'queryset': Entry.published_on_site.exclude(id__in=hasmenu), + 'template_object_name': 'entry', + 'extra_context': {'menus': Menu.objects.all()}, +} + +info_dict_full = { + 'queryset': Entry.published_on_site.all(), + 'template_object_name': 'entry', + 'extra_context': {'menus': Menu.objects.all()}, +} urlpatterns = patterns('', (r'^admin/', include('django.contrib.admin.urls')), + + url(regex='^$', + view='django.views.generic.list_detail.object_list', + kwargs=dict(info_dict, paginate_by=DIARIO_NUM_LATEST), + name='index'), + + url(regex='^(?P\d{4})/(?P[0-9]{2})/(?P\d{2})/(?P[-\w]+)/$', + view='diario.views.entries.entry_detail', + kwargs=dict(info_dict_full, slug_field='slug', month_format='%m', + date_field='pub_date'), + name='diario-entry'), + + (r'^', include('ema.eventos.urls')), + + # static media + (r'^(?Pimgs/.*)$', 'django.views.static.serve', MEDIA), + (r'^(?Pcss/.*)$', 'django.views.static.serve', MEDIA), )