From: Lincoln de Sousa Date: Fri, 27 Jul 2007 20:45:35 +0000 (-0300) Subject: adicionando view de notícias e adicionando listagem de menu X-Git-Url: http://git.cascardo.info/?a=commitdiff_plain;h=8252076472662acd88e4559e9634115514587af0;p=cascardo%2Feventmanager.git adicionando view de notícias e adicionando listagem de menu --- diff --git a/conteudo/views.py b/conteudo/views.py index 60f00ef..d7767a1 100644 --- a/conteudo/views.py +++ b/conteudo/views.py @@ -1 +1,9 @@ -# Create your views here. +from django.shortcuts import render_to_response +from django.template import RequestContext, Context +from eventmanager.conteudo.models import Noticia + +def noticia(request, nid): + n = Noticia.objects.get(pk=int(nid)) + c = Context({'noticia': n}) + return render_to_response('noticia.html', c, + context_instance=RequestContext(request)) diff --git a/templates/base.html b/templates/base.html index e69187e..866e564 100644 --- a/templates/base.html +++ b/templates/base.html @@ -76,6 +76,14 @@ {% endif %} + {% if menu %} + + {% endif %} +
{% block content %}{% endblock %}
diff --git a/templates/index.html b/templates/index.html index eb46c8e..efdbab8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,7 +9,7 @@
  • {{ i.titulo }}{{ i.data_criacao }} (por {{ i.autor }})

    {{ i.chamada }}

    - Leia mais + Leia mais
  • {% endfor %} diff --git a/urls.py b/urls.py index 2429e1f..8780f22 100644 --- a/urls.py +++ b/urls.py @@ -18,10 +18,12 @@ Boston, MA 02111-1307, USA. """ from django.conf.urls.defaults import * from django.conf import settings +from conteudo import views as conteudo_views import views import os urlpatterns = patterns('', + (r'^noticias/(\d+)/$', conteudo_views.noticia), (r'^admin/', include('django.contrib.admin.urls')), (r'^logout/', 'django.contrib.auth.views.logout', {'next_page': '/'}), diff --git a/views.py b/views.py index 8573791..1c3a6a4 100644 --- a/views.py +++ b/views.py @@ -20,12 +20,14 @@ from django.shortcuts import render_to_response from django.template import RequestContext, Context from eventmanager.decorators import enable_login_form from eventmanager.forms import InscreverPalestra, CadastroPalestrante -from eventmanager.conteudo.models import Noticia +from eventmanager.conteudo.models import Noticia, Menu @enable_login_form def index(request): news = Noticia.objects.order_by('-data_criacao') - c = Context({'news': news}) + menus = Menu.objects.all() + + c = Context({'news': news, 'menu': menus}) return render_to_response('index.html', c, context_instance=RequestContext(request))