I have a model, which has several "automatic" fields, like this:
class Message(Model):
subject = CharField(max_length = 200)
message = TextField()
created = DateTimeField()
last_status_change = DateTimeField()
status = CharField(max_length = 10)
In my database (Postgres) I set up default values for created, last_status_change, status
also, I set up a trigger to update last_status_change
every time status
changes.
However, when I try to create and save a model instance like this:
m = Message(subject = 'Hello', message = 'Long and boring day')
m.save()
Django tries to insert NULLs into those missing fields, which is wrong. Is there a way to make it emit insert without those fields or do I have to duplicate my DB functionality in the code?
Thanks!