Opened 8 years ago
Last modified 8 years ago
#27715 closed Bug
[Tutorial - part 6.] Lack of saving created question into db — at Initial Version
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
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()
Note:
See TracTickets
for help on using tickets.