Question about Django Tutorial Part 5

43 views
Skip to first unread message

Shun Liang

unread,
Oct 15, 2015, 5:09:47 AM10/15/15
to Django users
Dear All,

In the 5th part of the Django Tutorial ( https://docs.djangoproject.com/en/1.8/intro/tutorial05/#testing-our-new-view ), there is a helper function "create_question" in polls/test,py, which creates a question instance and returns it. However the created question instance does not seem to be saved anywhere in the code, so how does the test client retrieves the right information from the views, as it should not be in the DB if the save() method is never called?

Best,
Shun

Vijay Khemlani

unread,
Oct 15, 2015, 9:51:15 AM10/15/15
to django...@googlegroups.com
The "create" method (as in Question.objects.create) saves the object to the database

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2b5afd33-be21-4092-b4d7-46d18cfbb652%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages