X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=eventos%2Fmodels.py;h=eeae7a5d7378ba523a16cd030f69f8442f8233ab;hb=0052f08cb17810c9e5b79df2c086109e58909c9b;hp=39c68e26c400f22cd604ee561baf25dfeb795b11;hpb=55f829952598de38c69be652ed5dff6560523ae5;p=cascardo%2Feventmanager.git diff --git a/eventos/models.py b/eventos/models.py index 39c68e2..eeae7a5 100644 --- a/eventos/models.py +++ b/eventos/models.py @@ -1,4 +1,4 @@ -# -*- coding: utf8; -*- +# -*- coding: utf-8; -*- """ Copyright (C) 2007 Lincoln de Sousa @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. """ from django.db import models from django.contrib.localflavor.br.br_states import STATE_CHOICES as _states +from django.contrib.auth.models import User # bad hack! STATE_CHOICES = [(x, unicode(y).encode('utf8')) for x, y in _states] @@ -40,109 +41,152 @@ class Evento(models.Model): class Admin: fields = ( - (None, {'fields': ('nome', 'data_inicio', 'data_final')}), + ('Informações do evento', {'fields': ('nome', 'data_inicio', 'data_final')}), ('Informações da sede', {'fields': ('nome_local', 'nome_contato', - 'cidade', 'uf', 'rua', 'numero', 'info_adicional')}), + 'cidade', 'uf', 'rua', 'numero','telefone', 'info_adicional')}), ) def __str__(self): return self.nome -class AreaDeInteresse(models.Model): +class Palestrante(models.Model): nome = models.CharField(maxlength=100) + email = models.CharField(maxlength=100) - class Meta: - verbose_name = 'area de interesse' - verbose_name_plural = 'areas de interesse' + telefone = models.CharField(maxlength=100, blank=True) + celular = models.CharField(maxlength=100, blank=True) + + instituicao = models.CharField(maxlength=250, blank=True) + + rua = models.CharField(maxlength=100) + numero = models.CharField(maxlength=10) + bairro = models.CharField(maxlength=100) + cidade = models.CharField(maxlength=100) + uf = models.CharField(maxlength=3) + + minicurriculo = models.TextField('Mini currículo') + curriculo = models.TextField('Currículo') + + usuario = models.ForeignKey(User) class Admin: - pass + fields = ( + (None, {'fields': ('nome', 'email', 'instituicao', + 'minicurriculo', 'curriculo', 'usuario')}), + ('Telefones', {'fields': ('telefone', 'celular')}), + ('Endereço', {'fields': ('rua', 'numero', + 'bairro', 'cidade', 'uf')}), + ) def __str__(self): return self.nome -class Palestrante(models.Model): +class Participante(models.Model): nome = models.CharField(maxlength=100) email = models.CharField(maxlength=100) + rg = models.CharField(maxlength=100) + home_page = models.CharField(maxlength=100, blank=True) - telefone_residencial = models.CharField(maxlength=11, blank=True) - telefone_celular = models.CharField(maxlength=11, blank=True) - telefone_comercial = models.CharField(maxlength=11, blank=True) - + telefone = models.CharField(maxlength=100, blank=True) rua = models.CharField(maxlength=100) numero = models.CharField(maxlength=10) bairro = models.CharField(maxlength=100) cidade = models.CharField(maxlength=100) uf = models.CharField(maxlength=3) + cep = models.CharField(maxlength=8) + cpf_cnpj = models.CharField(maxlength=20, blank=True) - minicurriculo = models.TextField('Mini currículo') - area_interesse = models.ManyToManyField(AreaDeInteresse) + comercial = models.BooleanField(default=False) + usuario = models.ForeignKey(User) + refbanco = models.IntegerField(editable=False) class Admin: - fields = ( - (None, {'fields': ('nome', 'email', 'minicurriculo')}), - ('Telefones', {'fields': ('telefone_residencial', - 'telefone_celular', 'telefone_comercial')}), - ('Endereço', {'fields': ('rua', 'numero', - 'bairro', 'cidade', 'uf')}), - (None, {'fields': ('area_interesse',)}), - ) + pass def __str__(self): return self.nome -class Participante(models.Model): +class Caravana(models.Model): + coordenador = models.ForeignKey(Participante) + participantes = models.TextField() + + class Admin: + pass + + def __str__(self): + return str(self.coordenador) + + def parsed_participantes(self): + real_data = [] + for i in self.participantes.split('\n'): + if i.strip(): + nome, email = i.rsplit(' ', 1) + real_data.append({'nome': nome, 'email': email}) + return real_data + +class CategoriaTrabalho(models.Model): nome = models.CharField(maxlength=100) class Admin: pass + class Meta: + verbose_name = 'Categoria de trabalho' + verbose_name_plural = 'Categorias de trabalhos' + def __str__(self): return self.nome -class CategoriaPalestra(models.Model): +class TipoTrabalho(models.Model): nome = models.CharField(maxlength=100) class Admin: pass class Meta: - verbose_name = 'Categoria de palestra' - verbose_name_plural = 'Categorias de palestra' + verbose_name = 'Tipo de trabalho' + verbose_name_plural = 'Tipos de trabalho' def __str__(self): return self.nome -class Palestra(models.Model): +class Trabalho(models.Model): titulo = models.CharField(maxlength=100) - tema = models.CharField(maxlength=100) evento = models.ForeignKey(Evento) - categoria = models.ForeignKey(CategoriaPalestra) + tipo = models.ForeignKey(TipoTrabalho) + categoria = models.ForeignKey(CategoriaTrabalho) palestrante = models.ManyToManyField(Palestrante) descricao_curta = models.TextField() descricao_longa = models.TextField() + recursos = models.TextField() class Admin: fields = ( - (None, {'fields': ('titulo', 'tema', 'evento', 'categoria', - 'palestrante', 'descricao_curta', 'descricao_longa')}), + (None, {'fields': ('titulo', 'evento', 'categoria', 'tipo', + 'palestrante', 'descricao_curta', 'descricao_longa', + 'recursos')}), ) - def __str__(self): return self.titulo -class MiniCurso(models.Model): - titulo = models.CharField(maxlength=100) +class Avaliacao(models.Model): + avaliador = models.ManyToManyField(User) + comentario = models.TextField() + trabalho = models.ForeignKey(Trabalho) class Admin: pass + class Meta: + verbose_name = 'Avaliação' + verbose_name_plural = 'Avaliações' + def __str__(self): - return self.titulo + return self.nome