#27715: [Tutorial - part 6.] Lack of saving created question into db
-------------------------------+--------------------------------------
     Reporter:  UncleGoogle    |                    Owner:  nobody
         Type:  Bug            |                   Status:  closed
    Component:  Documentation  |                  Version:  1.10
     Severity:  Normal         |               Resolution:  invalid
     Keywords:  tutorial       |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  1              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by UncleGoogle):

 * keywords:  tutorial documentation => tutorial


Old description:

> I've been wondering for few hours why view tests fails despite the fact,
> everything is done the way tutorial shows:
> https://docs.djangoproject.com/en/1.10/intro/tutorial05/
>
> New-created Question objects had not been saved in temporary test
> database.
>
> Now, polls/tests.py is starts from:
> {{{
> def create_question(question_text, days):
>     time = timezone.now() + datetime.timedelta(days=days)
>     return Question.objects.create(question_text=question_text,
> pub_date=time)
> }}}
>
> For me works just:
> {{{
> def create_question(question_text, days):
>     time = timezone.now() + datetime.timedelta(days=days)
>     q = Question.objects.create(question_text=question_text,
> pub_date=time)
>     q.save()
> }}}

New description:

 I've been wondering for few hours why view tests fails despite the fact,
 everything is done the way tutorial shows:
 https://docs.djangoproject.com/en/1.10/intro/tutorial05/

 New-created Question objects had not been saved in temporary test
 database.

 Now, polls/tests.py starts from:
 {{{
 def create_question(question_text, days):
     time = timezone.now() + datetime.timedelta(days=days)
     return Question.objects.create(question_text=question_text,
 pub_date=time)
 }}}

 For me works just:
 {{{
 def create_question(question_text, days):
     time = timezone.now() + datetime.timedelta(days=days)
     q = Question.objects.create(question_text=question_text,
 pub_date=time)
     q.save()
 }}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27715#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.aeb4b395c029639140e8f8606b131a28%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to