﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31471	update_or_create object returns either an unparsed field (like a str) or datetime for DateTimeField, depending on whether object is saved or not.	Fonville		"I have a Telemetry class/model with a DateTimeField:
	
{{{
class Telemetry(models.Model):
    time_stamp = models.DateTimeField()
}}}
Whitin this class/model the time_stamp field is correctly treated as a Python `datetime` object


Telemetry has a OnetoOne relationship with another model:
{{{
class ExtraTelemetry(models.Model):
    telemetry = models.OneToOneField(Telemetry, on_delete=models.CASCADE, primary_key=True)
}}}

in this related ExtraTelemetery object I am fetching the value of the DateTimeField with:
`self.telemetry.time_stamp`

You'd expect this to be a Python `datetime` object too, but instead it returns a `str` object (e.g. `""2020-04-15T17:03:05Z""`)
I am only able to use the field as datetime object by parsing it myself with `dateutil.parser.parse(self.telemetry.time_stamp)` 

I think this is a bug, because it should be a datetime object and not a string, even when fetched through a relationship.
Django version is 3.0.5 with Python3.8.2 and SQLite"	Bug	closed	Database layer (models, ORM)	3.0	Normal	worksforme	datetime, OneToOne		Unreviewed	0	0	0	0	0	0
