Thanks Anthony, I didn't know that pytz is deprecated. Now with zoneinfo is
working.
Regards, Andres.
El miércoles, 30 de marzo de 2022 a la(s) 03:02:56 UTC-4, Antonis
Christofides escribió:
> Hi,
>
> not what you asked, but
>
> from settings import TIME_ZONE
>
> is an error. It happens to
Hi,
not what you asked, but
from settings import TIME_ZONE
is an error. It happens to work in this case, but generally you should write
from django.conf import settings
and then use "settings.TIME_ZONE". In Django, "settings" isn't a module, it's an
object. Django has some logic when
I need to save some fields in my database in the format YYY-MM-MM
00:00:00+00. So I decide to do this:
# setting.py
TIME_ZONE = 'America/Mexico_City'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# models.py
class Program(models.Model):
objects = models.Manager()
objects_custom = Program
Hello,
1. Please copy your code exactly. Is it really "pytz.timezone(TIME_ZONE)"? Or
is it "pytz.timezone(*settings.*TIME_ZONE)"? If it is the first one, please
include the definition or importing of TIME_ZONE.
2. Please pretty-print your dictionary. You can use pprint for that. If it
do
I need to save some fields in my database in the format YYY-MM-MM
00:00:00+00. So I decide to do this:
field_to_save = datetime.combine(date_to_save, time.min,
pytz.timezone(TIME_ZONE))
in settings.py I have:
TIME_ZONE = 'America/Mexico_City'
USE_I18N = True
USE_L10N = True
USE_TZ = True
My mode
5 matches
Mail list logo