Tuesday, June 4, 2013

Writing your first Django app - Tutorial Question

In the https://docs.djangoproject.com/en/1.5/intro/tutorial01/ tutorial under the,

Playing with the API



section, I'm trying to go through the example in my python shell as described.


p = Poll(question="What's new?", pub_date=timezone.now())

But I'm unable to get to next command "p.save()" because of the error below.

tony@tonymachine:~/django_projects/mysite$ python manage.py shell
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from polls.models import Poll, Choice
>>> Poll.objects.all()
[]
>>> from django.utils import timezone
>>> p = Poll(question="What's new?", pub_date=timezone.now())
Traceback (most recent call last):
 File "<console>", line 1, in <module>
 File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 415, in __init__
 raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])
TypeError: 'pub_date' is an invalid keyword argument for this function
>>>

Any guidance is appreciated.


--
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate