Fix bad merge
[cascardo/ema.git] / views.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2008 Lincoln de Sousa <lincoln@minaslivre.org>
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public
15 # License along with this program; if not, write to the
16 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
18 from diario.views.entries import entry_detail
19 from diario.models import Entry
20 from django.views.generic.date_based import object_detail
21 from ema.contents.models import Menu
22
23 def get_entry_by_slug(request, slug):
24     theone = Entry.objects.get(slug=slug)
25     return entry_detail(request,
26                         year=str(theone.pub_date.year),
27                         month=str(theone.pub_date.month),
28                         day=str(theone.pub_date.day),
29                         date_field='pub_date',
30                         slug=slug,
31                         slug_field='slug',
32                         month_format='%m',
33                         queryset=Entry.published_on_site.all(),
34                         template_object_name='entry',
35                         extra_context={'menus': Menu.objects.all()})