Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import unicode_literals
- from django.db import models
- class Empresa(models.Model):
- id_empresa = models.BigIntegerField(primary_key=True)
- nome = models.CharField(max_length=255)
- bol_status = models.IntegerField()
- def __str__(self):
- return self.nome
- class Meta:
- managed = False
- db_table = 'empresa'
- class Fornecedor(models.Model):
- id_fornecedor = models.AutoField(primary_key=True)
- char_fornecedor = models.CharField(max_length=1)
- nome_fornecedor = models.CharField(max_length=45, blank=True, null=True)
- def __str__(self):
- return self.nome_fornecedor
- class Meta:
- managed = False
- db_table = 'fornecedor'
- class Stick(models.Model):
- id_stick = models.AutoField(primary_key=True)
- char_stick = models.CharField(max_length=3)
- id_versao = models.ForeignKey('Versao', models.DO_NOTHING, db_column='id_versao')
- setor = models.CharField(max_length=45, blank=True, null=True)
- id_empresa = models.ForeignKey(Empresa, models.DO_NOTHING, db_column='id_empresa', blank=True, null=True)
- id_zabbix = models.IntegerField(blank=True, null=True)
- def __str__(self):
- return '%s-%s' % (self.char_versao, self.char_stick)
- class Meta:
- managed = False
- db_table = 'stick'
- unique_together = (('char_stick', 'id_versao'),)
- class Versao(models.Model):
- id_versao = models.AutoField(primary_key=True)
- char_versao = models.CharField(max_length=1)
- id_fornecedor = models.ForeignKey(Fornecedor, models.DO_NOTHING, db_column='id_fornecedor')
- def __str__(self):
- return '%s%s' % (self.char_fornecedor,self.char_versao)
- class Meta:
- managed = False
- db_table = 'versao'
- unique_together = (('char_versao', 'id_fornecedor'),)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement