--- /dev/null
+# -*- coding: utf-8; -*-
+# Copyright (C) 2007 Gabriel Falcão <root@gabrielfalcao.com>
+#
+# 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.http import HttpResponse, HttpResponseRedirect
+from django.template import RequestContext
+from django.shortcuts import render_to_response, get_object_or_404
+from django.conf import settings
+from django.core.exceptions import ObjectDoesNotExist
+
+class MetaDict:
+ """
+ Esta classe recebe um dicionario como parametro e adiciona cada
+ chave do dicionario em seu atributo, contendo o valor de cada item
+ """
+ def __init__(self, dictionary):
+ if isinstance(dictionary, dict):
+ for key, value in dictionary.items():
+ setattr(self, key, value)
+ else:
+ raise RuntimeError('MetaDict class only accepts a dictionary\
+ as parameter')
+ def __iter__(self):
+ for value in self.__dict__.values():
+ yield value
+
+ def __getitem__(self,index):
+ try:
+ return self.__dict__[index]
+ except:
+ return False
+
+ def __repr__(self):
+ return ", ".join(self.all())
+
+ def all(self):
+ return self.__dict__.keys()
+
+ def first(self):
+ return self.__dict__[self.__dict__.keys()[0]]
+
+ def last(self):
+ return self.__dict__[self.__dict__.keys()[-1]]
+
+ def slice(self,index):
+ try:
+ return self.__dict__[self.__dict__.keys()[index]]
+ except:
+ return False
+
+ def __contains__(self, item):
+ return item in self.__dict__.keys() or item in self.__dict__.values()
+
+ def as_dict(self):
+ return self.__dict__
+
+ def __len__(self):
+ return len(self.__dict__.keys())
+
+class empty:
+
+ def __default__(self):
+ return []
+
+ def __getattr__(self,*a):
+ return self.__default__
+
+ def __repr__(self):
+ return self.__default__
+
+ def __nonzero__(self):
+ return 1
+
+def get_object_or_list(obj,**kw):
+ try:
+ return obj(**kw)
+ except ObjectDoesNotExist:
+ return empty()
+
+def get_object_or_none(obj,**kw):
+ try:
+ return obj.objects.get(**kw)
+ except ObjectDoesNotExist:
+ return None
+ except AssertionError:
+ #hammer! hammer! hammer!
+ return empty()#obj.objects.filter(**kw)[0]
+
+def limpa_conversas(visitante, corretor):
+ conversas_vc = []
+ if isinstance(visitante, Visitante):
+ conversas_vc.append(get_object_or_none(Conversa,visitante__id=\
+ visitante.id))
+ if isinstance(corretor, Corretor):
+ conversas_vc.append(get_object_or_none(Conversa,corretor__id=\
+ corretor.id))
+ [c.delete() for c in conversas_vc if c]
--- /dev/null
+{% extends "base.html" %}
+{% block content %}
+
+{% if dados_palestra %}
+
+<h2>{{ dados_palestra.titulo }}</h2>
+{#dados_palestra.titulo#}
+{#dados_palestra.evento#}
+{#dados_palestra.tipo#}
+{#dados_palestra.categoria#}
+{#dados_palestra.palestrante#}
+{#dados_palestra.descricao_curta#}
+{#dados_palestra.descricao_longa#}
+{#dados_palestra.recursos#}
+
+<div class="content">
+ <h4>Palestrante{{ dados_palestra.palestrante.all|pluralize }}</h4>
+ <ul>
+ {% for p in dados_palestra.palestrante.all %}
+ <li>{{p.nome}}</li>
+ {% endfor %}
+ </ul>
+ <br />
+ {#<h4>Categoria</h4>#}
+ {#<p>{{dados_palestra.categoria.nome}}</p>#}
+
+ <h4>Descrição da palestra</h4>
+ <p>{{dados_palestra.descricao_longa}}</p>
+</div>
+
+{% else %}
+<div id="404" style="text-align:center">
+ <h2>Padre Quevedo 404</h2>
+ <br />
+ <div style="color:#FF0000;">
+ Palestra nón ecziste!
+ </div>
+</div>
+{% endif %}
+<a href="javascript:;" onclick="history.back ();">Voltar</a>
+{% endblock %}