I have a field in models that the True/False value will be affect by other field. May I know how to set it?
models.py:
class Product(models.Model):
storage_amount = models.PositiveIntegerField()
if storage_amount == 0 or None:
out_of_storage_or_not = models.BooleanField(default=True)
else:
out_of_storage_or_not = models.BooleanField(default=False)
Aucun commentaire:
Enregistrer un commentaire