adcbaa2e090507822c127b0210642a214abe3c28
[cascardo/eventmanager.git] / eventos / models.py
1 # -*- coding: utf-8; -*-
2 """
3 Copyright (C) 2007 Lincoln de Sousa <lincoln@archlinux-br.org>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with this program; if not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 """
20 from django.db import models
21
22
23 class Evento(models.Model):
24     nome = models.CharField(maxlength=100)
25     data_inicio = models.DateTimeField()
26     data_final = models.DateTimeField()
27
28     nome_local = models.CharField('Nome do local', maxlength=100)
29     nome_contato = models.CharField('Nome do contato', maxlength=100)
30     telefone = models.CharField(maxlength=100)
31     cidade = models.CharField(maxlength=100)
32     uf = models.CharField(maxlength=100) # TODO: should became a combobox
33     rua = models.CharField(maxlength=100)
34     numero = models.CharField('Número', maxlength=10)
35     info_adicional = models.TextField()
36
37     class Admin:
38         fields = (
39             (None, {'fields': ('nome', 'data_inicio', 'data_final')}),
40             ('Informações da sede', {'fields': ('nome_local', 'nome_contato',
41                 'cidade', 'uf', 'rua', 'numero', 'info_adicional')}),
42         )
43
44     def __str__(self):
45         return self.name
46
47
48 class AreaDeInteresse(models.Model):
49     nome = models.CharField(maxlength=100)
50
51     class Meta:
52         verbose_name = 'area de interesse'
53         verbose_name_plural = 'areas de interesse'
54
55     class Admin:
56         pass
57
58     def __str__(self):
59         return self.nome
60
61
62 class Palestrante(models.Model):
63     nome = models.CharField(maxlength=100)
64     email = models.CharField(maxlength=100)
65
66     telefone_residencial = models.CharField(maxlength=11)
67     telefone_celular = models.CharField(maxlength=11)
68     telefone_comercial = models.CharField(maxlength=11)
69
70     rua = models.CharField(maxlength=100)
71     numero = models.CharField(maxlength=10)
72     bairro = models.CharField(maxlength=100)
73     cidade = models.CharField(maxlength=100)
74     uf = models.CharField(maxlength=3)
75
76     minicurriculo = models.TextField('Mini currículo')
77     area_interesse = models.ManyToManyField(AreaDeInteresse)
78
79     class Admin:
80         fields = (
81             (None, {'fields': ('nome', 'email', 'minicurriculo')}),
82             ('Telefones', {'fields': ('telefone_residencial',
83                 'telefone_celular', 'telefone_comercial')}),
84             ('Endereço', {'fields': ('rua', 'numero',
85                 'bairro', 'cidade', 'uf')}),
86             (None, {'fields': ('area_interesse',)}),
87         )
88
89     def __str__(self):
90         return self.nome
91
92
93 class Participante(models.Model):
94     nome = models.CharField(maxlength=100)
95
96     class Admin:
97         pass
98
99     def __str__(self):
100         return self.nome
101
102
103 class CategoriaPalestra(models.Model):
104     nome = models.CharField(maxlength=100)
105
106     class Admin:
107         pass
108
109     class Meta:
110         verbose_name = 'Categoria de palestra'
111         verbose_name_plural = 'Categorias de palestra'
112
113     def __str__(self):
114         return self.nome
115
116
117 class Palestra(models.Model):
118     titulo = models.CharField(maxlength=100)
119     tema = models.CharField(maxlength=100)
120     evento = models.ForeignKey(Evento)
121     categoria = models.ForeignKey(CategoriaPalestra)
122     palestrante = models.ManyToManyField(Palestrante)
123     descricao_curta = models.TextField()
124     descricao_longa = models.TextField()
125
126     class Admin:
127         fields = (
128             (None, {'fields': ('titulo', 'tema', 'evento', 'categoria',
129                 'palestrante', 'descricao_curta', 'descricao_longa')}),
130         )
131
132
133     def __str__(self):
134         return self.titulo
135
136
137 class MiniCurso(models.Model):
138     titulo = models.CharField(maxlength=100)
139
140     class Admin:
141         pass
142
143     def __str__(self):
144         return self.titulo