Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27715 closed Bug (invalid)

[Tutorial - part 6.] Lack of saving created question into db

Reported by: Mieszko Bańczerowski Owned by: nobody
Component: Documentation Version: 1.10
Severity: Normal Keywords: tutorial
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Mieszko Bańczerowski)

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()

Change History (2)

comment:1 by Tim Graham, 8 years ago

Resolution: invalid
Status: newclosed

.create() does save the object. I guess you might have a mistake somewhere. Please see TicketClosingReasons/UseSupportChannels for ways to get help.

comment:2 by Mieszko Bańczerowski, 8 years ago

Description: modified (diff)
Keywords: documentation removed
Note: See TracTickets for help on using tickets.
Back to Top