Hello, I have a problem that DateField or DateTime fields are `str` instead of datetime objects after the model has been instantiated/created.
But when the model is returned from the database it is a correct object. How can I prevent this? given: ``` class My(models.Model): dt_obj = models.DateField("From", auto_now_add=True) dt_str = models.DateField("From", blank=True, null=True) ``` When: ``` o = My.objects.create(dt_str="2020-01-01") isinstance(o.dt_str, str) # True isinstance(o.dt_obj, str) # False - is datetime ``` But after ``` o.refresh_from_db() isinstance(o.dt_str, str) # False - is datetime isinstance(o.dt_obj, str) # False - is datetime ``` The conclusion is that with DateField it depends on what type has been used to create the instance. But when the object is returned from the database it is deserialized correctly. This is bizarre. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b2dd238c-704d-4f8b-bff2-8d9a3bedca12n%40googlegroups.com.