Hello All,

I'm using Django 2.0.1 and DRF djangorestframework==3.7.7 with USE_TZ = 
True.

The model field is declared as

modified = models.DateTimeField(auto_now=True)


Serializer

**
class Meta:
        fields = ('id', 'url', 'owners', 'type', 'title', 'abstract', 
'created', 'keywords',  'username', 'password', 'modified', )
        read_only_fields = ('owners', 'type', 'title', 'abstract', 
'keywords')
        extra_kwargs = {
            'username': {'write_only': True},
            'password': {'write_only': True}
        }



My local time is 2018-03-14T13:53:17 (UTC+1), I modify the record:

from models import model
m = model.objects.get(pk=1)
m.save()

vars(m) result is:
**
 'modified': datetime.datetime(2018, 3, 14, 12, 53, 17, 168977, tzinfo=<UTC
>),
**


In the DB the modified date is 2018-03-14 12:53:17.168977+00 (UTC). 

Now the API returns the JSON as:

"modified": "2018-03-14T13:53:17.168977+01:00",

Shouldn't be 2018-03-14T*12*:53:17.168977+01:00?

While adding:

REST_FRAMEWORK = {
    'DATETIME_FORMAT': "%Y-%m-%dT%H:%M:%S%z",

**



returns as  "modified": "2018-03-14T12:53:17+0000",

Ideas?

Thanks!



-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to