Hi all;
OS Debian Linux KDE desktop
Django 1.9
Python 3.5
Working with tutorial
https://docs.djangoproject.com/en/1.9/intro/tutorial05/
Writing polls/tests.py script
I am consistently getting an error:
NameError: name 'create_question' is not defined.
The first section of tests.py to throw this error is:
def test_index_view_with_two_past_questions(self):
"""
The questions index page may display multiple questions.
"""
create_question(question_text="Past question 1.", days=-30)
create_question(question_text="Past question 2.", days=-5)
response = self.client.get(reverse('polls:index'))
self.assertQuerysetEqual(
response.context['latest_question_list'],
['<Question: Past question 2.>', '<Question: Past question
1.>']
)
The code example is in class QuestionMethodTests(TestCase): but is
flagged 8 times by the editor throughout the code in test.py. The same
error pops at run time.
The code seems to be identical to the code in the tutorial.
All of the errors occur on code lines like:
create_question(question_text=" .......
All help will be appreciated.
Gary R.
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9aae93a5-daab-9f76-c8a5-8df9665cecb8%40verizon.net.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment