File:'str' object has no attribute 'tzinfo'
\AppData\Local\Programs\Python\Python36\lib\site-packages\pytz\__init__.py in localize
Code:
if dt.tzinfo is not None:
| Variable | Value |
|---|---|
| dt | '0000-00-00 00:00:00.000000' |
| is_dst | None |
| self | <UTC> |
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/43042199-3f20-4fef-bf30-9a4c53c32d6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
It looks like you're trying to localize a string, which is not a datetime object and, thus, doesn't have a tzinfo property.You'll have to convert your string to a datetime before trying to localize it.
On Wed, Jan 3, 2018 at 3:42 PM, Inter Nemo <pmrto...@gmail.com> wrote:
Django: 2.0.1
Error:File:'str' object has no attribute 'tzinfo'
...\AppData\Local\Programs\Python\Python36\lib\site-packages\pytz\__init__.pyinlocalize
Code:if dt.tzinfo is not None:
Local vars:
Variable Value dt '0000-00-00 00:00:00.000000'is_dst Noneself <UTC>
--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/43042199-3f20-4fef-bf30-9a4c53c32d6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
edit_date = models.DateTimeField('Edit the date', auto_now=True)