Validation of id with several status

0

I have a form for a warehouse in which I create several articles but each one can have several status, which recommend me to create several tables for the different status? or if you can allow me in the same table to have the product so many statuses possess, and then filter according to status.

model.py:

class Articulos(models.Model):

OPCIONES_TIPO_CHOICES = (
    ('P', 'Proveeduria'),
    ('V', 'Ventas'),
    ('D', 'Donacion'),
)

codigo_articulo = models.IntegerField(unique=True)
nombre_articulo = models.CharField(max_length=15)
tipo_articulo = models.CharField(max_length=12, choices=OPCIONES_TIPO_CHOICES, blank=True, null=True)
stock = models.IntegerField() 
ingreso_almacen = models.DateTimeField(auto_now_add=True)
costo_articulo = models.IntegerField(default=0)
fecha_modificacion = models.DateTimeField(auto_now=True)
especificaciones = models.FileField(upload_to="archivo/", null=True, blank=True)

def __str__(self):
    return '%s'% (self.codigo_articulo)

forms.py:

class ArticulosForm(ModelForm):
    class Meta:
        model = Articulos

    fields = [

        'codigo_articulo',
        'nombre_articulo',
        'tipo_articulo',
        'stock',
        'costo_articulo',
        'especificaciones',

    ]
    widgets = {
        'codigo_articulo': TextInput(attrs={'class':'form-control','placeholder':'Codigo del articulo'}),
        'nombre_articulo': TextInput(attrs={'class':'form-control','placeholder':'Nombre del articulo'}),
        'tipo_articulo': Select(attrs={'class':'form-control','placeholder':'Tipo de articulo'}),
        'stock': TextInput(attrs={'class':'form-control','placeholder':'Cantidad existente'}),            
        'costo_articulo': TextInput(attrs={'class':'form-control','placeholder':'Costo del articulo'}),
    }

I will appreciate your wise words and advice.

    
asked by Jhonny Barreto 24.09.2018 в 21:23
source

0 answers