From c99b6d00e0f8bd84a9f90102a354a51ba460588a Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Tue, 9 Oct 2007 12:52:57 -0300 Subject: [PATCH] Added "dia" as a date type in "trabalhos" table A date type for the presentations is used to order them. They were added in the presentations model and the SQL script to alter the table was adapted for that. --- eventos/models.py | 3 ++- sql/add_dia.sql | 2 +- views.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eventos/models.py b/eventos/models.py index a042a5b..e5955b7 100644 --- a/eventos/models.py +++ b/eventos/models.py @@ -165,12 +165,13 @@ class Trabalho(models.Model): descricao_longa = models.TextField() recursos = models.TextField() aprovado = models.BooleanField() + dia = models.DateField() class Admin: fields = ( (None, {'fields': ('titulo', 'evento', 'categoria', 'tipo', 'palestrante', 'descricao_curta', 'descricao_longa', - 'recursos', 'aprovado')}), + 'recursos', 'aprovado', 'dia')}), ) def __str__(self): diff --git a/sql/add_dia.sql b/sql/add_dia.sql index bbce8d5..799feb9 100644 --- a/sql/add_dia.sql +++ b/sql/add_dia.sql @@ -1 +1 @@ -ALTER TABLE eventos_trabalho ADD "dia" int; +ALTER TABLE eventos_trabalho ADD "dia" date; diff --git a/views.py b/views.py index edd63e4..d15746b 100644 --- a/views.py +++ b/views.py @@ -420,7 +420,7 @@ def dados_palestra(request, codigo): @enable_login_form def programacao(request): try: - d = {'aprovadas': Trabalho.objects.filter(aprovado=True)} + d = {'aprovadas': Trabalho.objects.filter(aprovado=True).order_by('dia')} except ObjectDoesNotExist: d = {} return build_response(request, 'programacao.html',d) -- 2.20.1