Re: Difficulty with Tutorial Part 2

2019-12-09 Thread Tafadzwa Marshal
I advice you to learn learn Python Language first before you start messing with Django. On Mon, Dec 9, 2019 at 2:19 AM Bruckner de Villiers < bruckner.devilli...@gmail.com> wrote: > Thank you Daniel. I believe that issue started with VSCode automatically > inserting “from date time import date ti

Re: Difficulty with Tutorial Part 2

2019-12-09 Thread Bruckner de Villiers
Thank you Daniel. I believe that issue started with VSCode automatically inserting “from date time import date time” after I hit enter on “import date time”. Thank you for the quick response. Bruckner 0836251086 > On 09 Dec 2019, at 10:38, Daniel Hepper wrote: > >  > You can fix your code

Re: Difficulty with Tutorial Part 2

2019-12-09 Thread Daniel Hepper
You can fix your code by changing datetime.timedelta to timedelta: *def* was_published_recently(self): return self.pub_date >= timezone.now() - timedelta(days=1) The statement "from datetime import datetime, timedelta" imports the classes datetime and timedelta from the module dateti

Re: Difficulty with Tutorial Part 2

2019-12-09 Thread Sencer Hamarat
Your timedelta import is correct but usage of the timedelta is not. Replace "datetime.timedelta(days=1)" with "timedelta(days=1)" Saygılarımla, Sencer HAMARAT On Mon, Dec 9, 2019 at 11:24 AM Bruckner de Villiers wrote: > Running Django 3.0 & Python 3.7.3 > > Everything works per the tutoria

Difficulty with Tutorial Part 2

2019-12-09 Thread Bruckner de Villiers
Running Django 3.0 & Python 3.7.3 Everything works per the tutorial until I get to: q.was_published_recently() It throws the following error: File "/Volumes/Data/DevelopmentTraining/django_tutorials/mysite/polls/models.py", line 19, in was_published_recently     return self.pub_date >= timez