vixi, mesma mensagem do commit anterior...
[cascardo/eventmanager.git] / eventos / models.py
1 # -*- coding: utf8; -*-
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 from django.contrib.localflavor.br.br_states import STATE_CHOICES as _states
22
23 # bad hack!
24 STATE_CHOICES = [(x, unicode(y).encode('utf8')) for x, y in _states]
25 del _states
26
27 class Evento(models.Model):
28     nome = models.CharField(maxlength=100)
29     data_inicio = models.DateTimeField()
30     data_final = models.DateTimeField()
31
32     nome_local = models.CharField('Nome do local', maxlength=100)
33     nome_contato = models.CharField('Nome do contato', maxlength=100)
34     telefone = models.CharField(maxlength=100)
35     cidade = models.CharField(maxlength=100)
36     uf = models.CharField(maxlength=2, choices=STATE_CHOICES)
37     rua = models.CharField(maxlength=100)
38     numero = models.CharField('Número', maxlength=10)
39     info_adicional = models.TextField()
40
41     class Admin:
42         fields = (
43             (None, {'fields': ('nome', 'data_inicio', 'data_final')}),
44             ('Informações da sede', {'fields': ('nome_local', 'nome_contato',
45                 'cidade', 'uf', 'rua', 'numero', 'info_adicional')}),
46         )
47
48     def __str__(self):
49         return self.nome
50
51
52 class AreaDeInteresse(models.Model):
53     nome = models.CharField(maxlength=100)
54
55     class Meta:
56         verbose_name = 'area de interesse'
57         verbose_name_plural = 'areas de interesse'
58
59     class Admin:
60         pass
61
62     def __str__(self):
63         return self.nome
64
65
66 class Palestrante(models.Model):
67     nome = models.CharField(maxlength=100)
68     email = models.CharField(maxlength=100)
69
70     telefone_residencial = models.CharField(maxlength=11, blank=True)
71     telefone_celular = models.CharField(maxlength=11, blank=True)
72     telefone_comercial = models.CharField(maxlength=11, blank=True)
73
74     rua = models.CharField(maxlength=100)
75     numero = models.CharField(maxlength=10)
76     bairro = models.CharField(maxlength=100)
77     cidade = models.CharField(maxlength=100)
78     uf = models.CharField(maxlength=3)
79
80     minicurriculo = models.TextField('Mini currículo')
81     area_interesse = models.ManyToManyField(AreaDeInteresse)
82
83     class Admin:
84         fields = (
85             (None, {'fields': ('nome', 'email', 'minicurriculo')}),
86             ('Telefones', {'fields': ('telefone_residencial',
87                 'telefone_celular', 'telefone_comercial')}),
88             ('Endereço', {'fields': ('rua', 'numero',
89                 'bairro', 'cidade', 'uf')}),
90             (None, {'fields': ('area_interesse',)}),
91         )
92
93     def __str__(self):
94         return self.nome
95
96
97 class Participante(models.Model):
98     nome = models.CharField(maxlength=100)
99
100     class Admin:
101         pass
102
103     def __str__(self):
104         return self.nome
105
106
107 class CategoriaPalestra(models.Model):
108     nome = models.CharField(maxlength=100)
109
110     class Admin:
111         pass
112
113     class Meta:
114         verbose_name = 'Categoria de palestra'
115         verbose_name_plural = 'Categorias de palestra'
116
117     def __str__(self):
118         return self.nome
119
120
121 class Palestra(models.Model):
122     titulo = models.CharField(maxlength=100)
123     tema = models.CharField(maxlength=100)
124     evento = models.ForeignKey(Evento)
125     categoria = models.ForeignKey(CategoriaPalestra)
126     palestrante = models.ManyToManyField(Palestrante)
127     descricao_curta = models.TextField()
128     descricao_longa = models.TextField()
129
130     class Admin:
131         fields = (
132             (None, {'fields': ('titulo', 'tema', 'evento', 'categoria',
133                 'palestrante', 'descricao_curta', 'descricao_longa')}),
134         )
135
136
137     def __str__(self):
138         return self.titulo
139
140
141 class MiniCurso(models.Model):
142     titulo = models.CharField(maxlength=100)
143
144     class Admin:
145         pass
146
147     def __str__(self):
148         return self.titulo