2👍
First of all, your database appears to be incompletely normalized. The use of comma separate values in a column or an array type is usually a good indication of that.
Secondly.
Tip: Arrays are not sets; searching for specific array elements can be
a sign of database misdesign. Consider using a separate table with a
row for each item that would be an array element. This will be easier
to search, and is likely to scale better for a large number of
elements.
Arrays are just postgresql’s way of giving you enough rope to …
Your best bet really is to normalize your database. Your inferior option is to set blank=True, null = True
view_time = ArrayField(
models.DateTimeField(auto_now_add=True), blank=True, null=True)
That’s because when you do the following django has no reason to create any DateTimeField objects at all.
recent_views = UserRecentViews.objects.create()
So it just sets the array field as null, which is not allowed.
Oh to be more specific
but why django can not create object with current datetime
because you are not telling it to.