class Pedidos(models.Model): fecha = models.DateTimeField(auto_now_add=True) modo_pago = models.CharField(max_length=50) para_llevar = models.CharField(max_length=50) num_avisador = models.CharField(max_length=50) direccion = models.CharField(max_length=150, default="No hay direccion", null=True) total = models.DecimalField(max_digits=20, decimal_places=2, null=True, default=0.0) estado = models.CharField(max_length=10, default="PG_NO") entrega = models.DecimalField(max_digits=20, decimal_places=2, null=True, default=0.0) cambio = models.DecimalField(max_digits=20, decimal_places=2, null=True, default=0.0) modify = models.DateTimeField(auto_now=True) servido = models.BooleanField(default=False) def __unicode__(self): return u"{0} - {1} - {2}".format(self.id, self.estado, self.total) class Meta: verbose_name = "Pedido"
class LineasPedido(models.Model): text = models.CharField(max_length=50) des = models.TextField(null=True) cant = models.IntegerField() precio = models.DecimalField(max_digits=20, decimal_places=2) total = models.DecimalField(max_digits=20, decimal_places=2) tipo = models.CharField(max_length=50) pedidos = models.ForeignKey(Pedidos, on_delete=models.CASCADE) modify = models.DateTimeField(auto_now=True)
class Clientes(models.Model): nombre = models.CharField(max_length=50) apellido = models.CharField(max_length=100, null=True) email = models.EmailField(max_length=100, null=True, blank=True) telefono = models.CharField(max_length=20) nota = models.TextField(null=True) pedidos = models.ManyToManyField(Pedidos) fecha_add = models.DateField(auto_now_add=True) modify = models.DateTimeField(auto_now=True) direccion = models.IntegerField(null=True)
class Pedidos(models.Model): fecha = models.DateTimeField(auto_now_add=True) modo_pago = models.CharField(max_length=50) para_llevar = models.CharField(max_length=50) num_avisador = models.CharField(max_length=50) total = models.DecimalField(max_digits=20, decimal_places=2) estado = models.CharField(max_length=10, default="PG_NO") entrega = models.DecimalField(max_digits=20, decimal_places=2) cambio = models.DecimalField(max_digits=20, decimal_places=2) modify = models.DateTimeField(auto_now=True)
class TestFields(models.Model): char = models.CharField(max_length=100) text = models.TextField() date = models.DateField(auto_now_add=True) date_time = models.DateTimeField(auto_now=True) boolean = models.BooleanField() integer = models.IntegerField() decimal = models.DecimalField(5, 2)
class Publication(models.Model): title = models.CharField(max_length=30) class Meta: ordering = ['title'] def __str__(self): return self.title
class Article(models.Model): headline = models.CharField(max_length=100) publications = models.ManyToManyField(Publication) class Meta: ordering = ['headline'] def __str__(self): return self.headline
class LineasPedido(models.Model): text = models.CharField(max_length=50) des = models.TextField(null=True) cant = models.IntegerField() precio = models.DecimalField(max_digits=20, decimal_places=2, null=True, default=0.0) total = models.DecimalField(max_digits=20, decimal_places=2, null=True, default=0.0) tipo = models.CharField(max_length=50) pedidos = models.ForeignKey(Pedidos, on_delete=models.CASCADE) modify = models.DateTimeField(auto_now=True) servido = models.BooleanField(default=False) imprimible = models.BooleanField(default=False) def __unicode__(self): return u"{0} - {1} - {2} - {3}".format(self.cant, self.text, self.precio, self.total)
class PedidosExtra(models.Model): importe = models.DecimalField(max_digits=20, decimal_places=2) numero_pedido = models.IntegerField() modo_pago = models.CharField(max_length=50, null=True, blank=True, default="Efectivo") modify = models.DateTimeField(auto_now=True) estado = models.CharField(max_length=50, null=True, blank=True, default="no_arqueado")
class Conteo(models.Model): can = models.IntegerField() tipo = models.DecimalField(max_digits=20, decimal_places=2) total = models.DecimalField(max_digits=20, decimal_places=2) texto_tipo = models.CharField(max_length=100, null=True, blank=True) modify = models.DateTimeField(auto_now=True)
class Gastos(models.Model): des = models.CharField(max_length=100) gasto = models.DecimalField(max_digits=20, decimal_places=2) modify = models.DateTimeField(auto_now=True)
class Album(models.Model): artist = models.ForeignKey(Musician, on_delete=models.CASCADE) name = models.CharField(max_length=100) release_date = models.DateField() num_stars = models.IntegerField()
class Musician(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) instrument = models.CharField(max_length=100)
class Person(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) casado = models.BooleanField()
class TestNullFields(models.Model): char_can_null = models.CharField(max_length=20, null=True) char__default_not_null = models.CharField(max_length=12, default="caracola")
class Direcciones(models.Model): direccion = models.CharField(max_length=150) localidad = models.CharField(max_length=50, default="Grandada", null=True) codigo = models.CharField(max_length=10, null=True) clientes = models.ForeignKey(Clientes, on_delete=models.CASCADE) modify = models.DateTimeField(auto_now=True)