I have the following model that has a Boolean field among others
class Prb(models.Model):
#other fields
disabled = models.BooleanField(default=False)
and a modelform for the model
class PrbModelForm(ModelForm):
class Meta:
model=Prb
In my view I render prbmodelform with a prb as instance
prb = get_object_or_404(Prb, pk=4)
prb_model_form = PrbModelForm(request.POST or None, instance=prb)
prb.disabled field for this model is 0 (using SQLite database) but when I render the form although disabled field is 0 checkbox is checked. How can I solve this problem? I want to add here that disabled is an SQLite Boolean field, and that the data schema was transformed in to models using inspectdb. Why doesn't it render the checkbox status correctly?
Aucun commentaire:
Enregistrer un commentaire