adicionando as views e fazendo o login funcionar
[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 Admin:
52         pass
53
54     def __str__(self):
55         return self.nome
56
57
58 class Palestrante(models.Model):
59     nome = models.CharField(maxlength=100)
60     email = models.CharField(maxlength=100)
61
62     telefone_residencial = models.CharField(maxlength=11)
63     telefone_celular = models.CharField(maxlength=11)
64     telefone_comercial = models.CharField(maxlength=11)
65
66     rua = models.CharField(maxlength=100)
67     numero = models.CharField(maxlength=10)
68     bairro = models.CharField(maxlength=100)
69     cidade = models.CharField(maxlength=100)
70     uf = models.CharField(maxlength=3)
71
72     minicurriculo = models.TextField('Mini currículo')
73     area_interesse = models.ManyToManyField(AreaDeInteresse)
74
75     class Admin:
76         fields = (
77             (None, {'fields': ('nome', 'email', 'minicurriculo')}),
78             ('Telefones', {'fields': ('telefone_residencial',
79                 'telefone_celular', 'telefone_comercial')}),
80             ('Endereço', {'fields': ('rua', 'numero',
81                 'bairro', 'cidade', 'uf')}),
82             (None, {'fields': ('area_interesse',)}),
83         )
84
85     def __str__(self):
86         return self.nome
87
88
89 class Participante(models.Model):
90     nome = models.CharField(maxlength=100)
91
92     class Admin:
93         pass
94
95     def __str__(self):
96         return self.nome
97
98
99 class CategoriaPalestra(models.Model):
100     nome = models.CharField(maxlength=100)
101
102     class Admin:
103         pass
104
105     class Meta:
106         verbose_name = 'Categoria de palestra'
107         verbose_name_plural = 'Categorias de palestra'
108
109     def __str__(self):
110         return self.nome
111
112
113 class Palestra(models.Model):
114     titulo = models.CharField(maxlength=100)
115     tema = models.CharField(maxlength=100)
116     evento = models.ForeignKey(Evento)
117     categoria = models.ForeignKey(CategoriaPalestra)
118     palestrante = models.ManyToManyField(Palestrante)
119     descricao_curta = models.TextField()
120     descricao_longa = models.TextField()
121
122     class Admin:
123         fields = (
124             (None, {'fields': ('titulo', 'tema', 'evento', 'categoria',
125                 'palestrante', 'descricao_curta', 'descricao_longa')}),
126         )
127
128
129     def __str__(self):
130         return self.titulo
131
132
133 class MiniCurso(models.Model):
134     titulo = models.CharField(maxlength=100)
135
136     class Admin:
137         pass
138
139     def __str__(self):
140         return self.titulo