from diario.settings import DIARIO_NUM_LATEST
from diario.models import Entry
from contents.models import Menu
+from ema.views import get_entry_by_slug
MEDIA = {'document_root': settings.INSTANCE('media')}
date_field='pub_date'),
name='diario-entry'),
+ (r'^([-\w]+)/$', get_entry_by_slug),
(r'^', include('ema.eventos.urls')),
# static media
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2008 Lincoln de Sousa <lincoln@minaslivre.org>
+#
+# 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 diario.views.entries import entry_detail
+from diario.models import Entry
+from django.views.generic.date_based import object_detail
+from ema.contents.models import Menu
+
+def get_entry_by_slug(request, slug):
+ theone = Entry.objects.get(slug=slug)
+ return entry_detail(request,
+ year=str(theone.pub_date.year),
+ month=str(theone.pub_date.month),
+ day=str(theone.pub_date.day),
+ date_field='pub_date',
+ slug=slug,
+ slug_field='slug',
+ month_format='%m',
+ queryset=Entry.published_on_site.all(),
+ template_object_name='entry',
+ extra_context={'menus': Menu.objects.all()})