My doubt is to be able to make fields that are with exclude can be filled through a form but I still do not know how to show these same data
models.py code
class Producto(models.Model):
nombre = models.CharField(max_length=100)
caracteristica= models.CharField(max_length=10)
codigo = models.CharField(max_length=100)
estado = models.BooleanField(default=True)
observacion = models.CharField(max_length=100, default=True)
form.py code
class ProductoForm(ModelForm):
class Meta:
model = Proveedor
exclude = ['estado' , 'observacion']
views.py code
def crear_producto(request):
if request.method == 'POST':
form = ProductoForm(request.POST)
if form.is_valid():
form.save()
return redirect('producto:producto_list')
else:
form = venta_form()
return render(request, 'almacenes/productos_crear.html', {'form': form})
Button code where I call the form.html
<a href="{% url 'producto:crear_producto' %}" class="btn btn-success" title="Baja Proveedor"> Crear </a>
<!-- Parte del boton del codigo de los exclude -->
<a href=" " class="btn btn-primary" title="Dar Obervacion y Estado">Mas ... </a>