Django

Code

Ticket #5240 (closed: invalid)

Opened 3 years ago

Last modified 3 years ago

error in tutorial

Reported by: cristi.tudose@gmail.com Assigned to: jacob
Milestone: Component: Documentation
Version: 0.96 Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

hi.

Today I have started learn django. It's amazing !!! But !

URL: http://www.djangoproject.com/documentation/tutorial01/

polls/models.py

from django.db import models

class Poll(models.Model):

question = models.CharField?(max_length=200) pub_date = models.DateTimeField?('date published')

class Choice(models.Model):

poll = models.ForeignKey(Poll) choice = models.CharField?(max_length=200) votes = models.IntegerField?()

It's not max_length=200 ! it's maxlength=200

after execution:

devserver # python manage.py sql polls mysite.polls: init() got an unexpected keyword argument 'max_length' 1 error found. Traceback (most recent call last):

File "manage.py", line 11, in <module>

execute_manager(settings)

File "/usr/local/lib/python2.5/site-packages/django/core/management.py", line 1678, in execute_manager

execute_from_command_line(action_mapping, argv)

File "/usr/local/lib/python2.5/site-packages/django/core/management.py", line 1626, in execute_from_command_line

mod_list = [models.get_app(app_label) for app_label in args[1:]]

File "/usr/local/lib/python2.5/site-packages/django/db/models/loading.py", line 40, in get_app

mod = load_app(app_name)

File "/usr/local/lib/python2.5/site-packages/django/db/models/loading.py", line 51, in load_app

mod = import(app_name, {}, {}, models?)

File "/usr/local/www/apache22/data/cristi.prosportequipment.ro/mysite/../mysite/polls/models.py", line 3, in <module>

class Poll(models.Model):

File "/usr/local/www/apache22/data/cristi.prosportequipment.ro/mysite/../mysite/polls/models.py", line 4, in Poll

question = models.CharField?(max_length=200)

TypeError?: init() got an unexpected keyword argument 'max_length'

polls.poll: "question": CharFields? require a "maxlength" attribute. polls.choice: "choice": CharFields? require a "maxlength" attribute.

If I'm wrong, excuse me. I use django on a FreeBSD box. And I installed django from ports.

Thanks !

Attachments

Change History

08/24/07 05:50:13 changed by russellm

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to invalid.
  • needs_tests changed.
  • needs_docs changed.

max_length is a recent change (i.e., post 0.96 release). The tutorial is correct for the current subversion trunk, and the tutorial contains a link to the old 0.96 tutorial.


Add/Change #5240 (error in tutorial)




Change Properties
Action