It's possible that exist and confusion using libraries due to the versions
of python. Try this in the import :

from datetime import datetime


El vie., 12 oct. 2018 a las 16:07, User1 (<acary...@gmail.com>) escribió:

> Hello, I am practicing the tutorial part 5, Test and I got an error I can
> solve.
> The code in shell is:
>
> (mientorno) C:\Users\user1\djangowom>python manage.py shell
> Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit
> (AMD64)]
>  on win32
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>>
> >>>
> >>>
> >>> import datetime
> >>> from django.utils import timezone
> >>> from polls.models import Question
> >>> future_question = Question(pub_date=timezone.now() +
> datetime.timedelta(days=30))
> >>> future_question.was_published_recently()
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
>   File "C:\Users\arojas\djangowom\polls\models.py", line 12, in
> was_published_re
> cently
>     return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
> AttributeError: type object 'datetime.datetime' has no attribute
> 'timedelta'
> >>>
>
> Any idea? Thanks a lot.
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@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/6fe58b1b-f6d5-41b6-9193-ff00d938420f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6fe58b1b-f6d5-41b6-9193-ff00d938420f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/CAB6zZ72-S_ZBT_35C8H934kk-vGY8XipPenq3Wkm7NuuegHp8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to