from django.db import models


class ZeroDateTimeField(models.DateTimeField):

    def get_db_prep_value(self, value, connection, prepared=False):
        value = super(ZeroDateTimeField, self).get_db_prep_value(value,
            connection, prepared)
if value is None:
    return '0000-00-00 00:00:00'
return value
Django ORM, Insert None datetime as 0 into MySQL