This is the model I am using:
class Comment(MPTTModel):
comment = models.CharField(max_length=1023)
resource = models.ForeignKey('Resource')
created_at = models.DateTimeField(auto_now_add=True)
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
author = models.ForeignKey(User)
class MPTTMeta:
order_insertion_by = ['created_at']
However, when I try to add a comment from the admin site I get:
ValueError at /admin/app/comment/add/
Cannot use None as a query value
Am I doing something wrong with my model? I feel like django-mptt is trying to get the DateTimeField while it is still "None", before it has been set at the db level.