Reputation: 29557
My tables are specified as models in Python, which are then made into MySQL tables by Django. In Python:
class my_table(models.Model):
is_correct = models.IntegerField(default = 0)
If I do an insert into this table then I want it to automatically insert 0 for the column is_correct
unless I specify a different value. I also want this to happen if I am using raw sql or if I am inserting from a MySQL stored procedure.
The default
argument only seems to work from within Python. It's not translated into anything that MySQL sees. Is such a thing possible?
Upvotes: 3
Views: 1540