1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2008 Lincoln de Sousa <lincoln@minaslivre.org>
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.
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.
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 django.db import models
19 from django.contrib.localflavor.br.br_states import STATE_CHOICES
20 from django.contrib.auth.models import User
22 class Evento(models.Model):
23 nome = models.CharField(max_length=100)
24 data_inicio = models.DateField(u'Data de início')
25 data_final = models.DateField()
27 local = models.CharField(max_length=100)
28 nome_contato = models.CharField(u'Nome do contato', max_length=100)
29 telefone = models.CharField(max_length=100)
30 endereco = models.TextField()
31 cidade = models.CharField(max_length=100)
32 estado = models.CharField(max_length=2, choices=STATE_CHOICES)
33 info_adicional = models.TextField(blank=True)
37 (u'Informações do evento',
38 {'fields': ('nome', 'data_inicio', 'data_final')}),
40 (u'Informações da sede',
41 {'fields': ('local', 'nome_contato', 'endereco', 'cidade',
42 'estado', 'telefone', 'info_adicional')}),
45 search_fields = list_display = 'nome', 'local'
50 class Palestrante(models.Model):
51 nome = models.CharField(max_length=100)
52 email = models.CharField(max_length=100)
54 telefone = models.CharField(max_length=100, blank=True)
55 celular = models.CharField(max_length=100, blank=True)
57 instituicao = models.CharField(u'Instituição', max_length=250, blank=True)
59 endereco = models.TextField()
60 cep = models.CharField(max_length=5)
61 cidade = models.CharField(max_length=100)
62 estado = models.CharField(max_length=2, choices=STATE_CHOICES)
64 minicurriculo = models.TextField(u'Mini currículo')
65 curriculo = models.TextField(u'Currículo')
67 usuario = models.ForeignKey(User, help_text=u'Este campo associa o '
68 'palestrante a uma conta no sistema para '
69 'que ele possa enviar trabalhos e alterar '
74 (None, {'fields': ('nome', 'email', 'instituicao',
75 'minicurriculo', 'curriculo')}),
77 (u'Telefones', {'fields': ('telefone', 'celular')}),
79 (u'Endereço', {'fields': ('endereco', 'cep', 'cidade', 'estado')}),
81 (u'Avançado', {'fields': ('usuario',),
82 'classes': 'collapse'}),
85 search_fields = list_display = 'nome', 'instituicao', 'email', 'celular'
90 class TipoTrabalho(models.Model):
91 nome = models.CharField(max_length=100)
94 search_fields = 'nome',
97 verbose_name = u'Tipo de trabalho'
98 verbose_name_plural = u'Tipos de trabalho'
103 class Trabalho(models.Model):
104 titulo = models.CharField(max_length=100)
105 evento = models.ForeignKey(Evento)
106 tipo = models.ForeignKey(TipoTrabalho)
107 palestrante = models.ForeignKey(Palestrante)
108 descricao_curta = models.TextField(u'Descrição curta')
109 descricao_longa = models.TextField(u'Descrição longa')
110 recursos = models.TextField(blank=True)
111 outros_palestrantes = \
112 models.ManyToManyField(Palestrante,
113 related_name='outros_palestrantes',
118 list_filter = 'evento', 'tipo'
119 search_fields = list_display = 'titulo', 'evento', 'tipo'