#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 )
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 , 8 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 8 years ago
Description: | modified (diff) |
---|---|
Keywords: | documentation removed |
Note:
See TracTickets
for help on using tickets.
.create()
does save the object. I guess you might have a mistake somewhere. Please see TicketClosingReasons/UseSupportChannels for ways to get help.