Last active
October 28, 2015 00:18
-
-
Save anachronic/796934152c92e40c3ef3 to your computer and use it in GitHub Desktop.
modelo de inge 2
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
from django.db import models | |
class TipoDato(models.Model): | |
magnitud = models.CharField(max_length=100) | |
unidad = models.CharField(max_length=100) | |
class Datos(models.Model): | |
timestamp = models.DateTimeField() | |
valor = models.IntegerField() | |
tipo_dato = models.ForeignKey('TipoDato') | |
dispositivo = models.ForeignKey('Dispositivo') | |
class Dispositivo(models.Model): | |
recinto = models.ForeignKey('Recinto') | |
descripcion = models.CharField(max_length=200) | |
serial = models.IntegerField() | |
email_encargado = models.CharField(max_length=200) | |
class Recinto(models.Model): | |
nombre = models.CharField(max_length=200) | |
local = models.ForeignKey('Local') | |
telefono = models.CharField(max_length=100) | |
email = models.CharField(max_length=100) | |
class Local(models.Model): | |
nombre = models.CharField(max_length=200) | |
local = models.ForeignKey('Institucion') | |
telefono = models.CharField(max_length=100) | |
email = models.CharField(max_length=100) | |
class Institucion(models.Model): | |
nombre = models.CharField(max_length=200) | |
telefono = models.CharField(max_length=100) | |
email = models.CharField(max_length=100) | |
class Indicador(models.Model): | |
tipo_dato = models.ForeignKey('TipoDato') | |
nombre = models.CharField(max_length=200) | |
descripcion = models.CharField(max_length=200) | |
dispositivo = models.ForeignKey('Dispositivo', null=True) | |
formula = models.TextField() | |
es_grafico = models.BooleanField(default=True) | |
class Usuario(models.Model): | |
user = models.CharField(max_length=100) | |
password = models.CharField(max_length=100) | |
sal = models.CharField(max_length=100) | |
nombre = models.CharField(max_length=100) | |
apellido_paterno = models.CharField(max_length=100, null=True) | |
apellido_materno = models.CharField(max_length=100, null=True) | |
indicadores = models.ManyToManyField(Indicador, through='PermisoIndicador', through_fields=('usuario', 'indicador')) | |
roles = models.ManyToManyField(Rol) | |
class PermisoIndicador(models.Model): | |
usuario = models.ForeignKey('Usuario') | |
indicador = models.ForeignKey('Indicador') | |
prioridad = models.IntegerField(default=-1) | |
class Canal(models.Model): | |
dispositivo = models.ForeignKey('Dispositivo') | |
numero = models.IntegerField() | |
estado = models.CharField(max_length=1) | |
descripcion = models.CharField(max_length=100) | |
class Rol(models.Model): | |
descripcion = models.CharField(max_length=255) | |
class Alarma(models.Model): | |
dispositivo = models.ForeignKey('Dispositivo') | |
formula = models.TextField() | |
email = models.CharField(max_length=100) | |
class Variable(models.Model): | |
nombre = models.CharField(max_length=100, unique=True) | |
valor = models.FloatField() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Modelo de datos de ingenieria de software 2