Datetime Field Received a Naive Datetime Datetime Field Received a Naive Datetime django django

Datetime Field Received a Naive Datetime


You can use faker as follows:

import factoryfrom django.utils import timezoneclass PostFactory(factory.DjangoModelFactory):    FACTORY_FOR = models.Post    value = 42    created = factory.Faker("date_time", tzinfo=timezone.get_current_timezone())


You need to change timezone in settings.py also.

When USE_TZ is False, this is the time zone in which Django will store all datetimes. When USE_TZ is True, this is the default time zone that Django will use to display datetimes in templates and to interpret datetimes entered in forms.