Created
January 26, 2012 22:22
-
-
Save luzfcb/1685490 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --*-- coding: utf-8 --*-- | |
from django.db import models | |
# Create your models here. | |
class TipoLicencaDeUso(models.Model): | |
nome = models.CharField(max_length=255) | |
descricao = models.TextField(verbose_name=u"Descrição") | |
sigla = models.CharField(max_length=20) | |
class Meta: | |
verbose_name = u"Tipo de Licença de Uso" | |
verbose_name_plural = u"Tipos de Licença de Uso" | |
def __unicode__(self): | |
return u"Tipo de Licença: " + self.nome | |
class Licenca(models.Model): | |
nome = models.CharField(max_length=255) | |
descricao = models.CharField(max_length=255) | |
LICENCA_EDUCACIONAL = 'LICENCA_EDUCACIONAL' | |
LICENCA_COMERCIAL = 'LICENCA_COMERCIAL' | |
LICENCA_CODIGO_ABERTO = 'LICENCA_CODIGO_ABERTO' | |
TIPO_LICENCA = ( | |
(LICENCA_EDUCACIONAL, 'Educacional'), | |
(LICENCA_COMERCIAL, 'Comercial'), | |
(LICENCA_CODIGO_ABERTO, 'Codigo Aberto'), | |
) | |
tipo = models.CharField(max_length=255, choices=TIPO_LICENCA) | |
PERIODO_PERMANENTE = 'PERIODO_PERMANENTE' | |
PERIODO_TEMPORARIO = 'PERIODO_TEMPORARIO' | |
PERIODO_DURACAO = ( | |
(PERIODO_PERMANENTE, "Permanente"), | |
(PERIODO_TEMPORARIO, "Temporario") | |
) | |
periodo_de_duracao = models.CharField(max_length=255, choices=PERIODO_DURACAO) | |
def __unicode__(self): | |
return 'Nome: ' + self.nome + ' - Tipo: ' + self.tipo + ' - Uso: ' + self.periodo_de_duracao | |
class Software(models.Model): | |
nome = models.CharField(max_length=255) | |
versao = models.CharField(max_length=30, verbose_name=u"Versão") | |
desenvolvedor = models.CharField(max_length=255) | |
tipo_licenca_de_uso = models.ForeignKey(TipoLicencaDeUso, verbose_name=u"Tipo de Licença de Uso") | |
descricao = models.TextField() | |
def __unicode__(self): | |
return u'Nome: ' + self.nome + u" - Versão: " + self.versao + u" - " + self.tipo_licenca_de_uso.__unicode__() | |
class MonthlyWeatherByCity(models.Model): | |
month = models.IntegerField() | |
boston_temp = models.DecimalField(max_digits=5, decimal_places=1) | |
houston_temp = models.DecimalField(max_digits=5,decimal_places=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment