Opened 11 years ago

Closed 11 years ago

#5240 closed (invalid)

error in tutorial

Reported by: cristi.tudose@… Owned by: Jacob
Component: Documentation Version: 0.96
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:



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



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 sql polls
mysite.polls: init() got an unexpected keyword argument 'max_length'
1 error found.
Traceback (most recent call last):

File "", line 11, in <module>


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

execute_from_command_line(action_mapping, argv)

File "/usr/local/lib/python2.5/site-packages/django/core/", 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/", line 40, in get_app

mod = load_app(app_name)

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

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

File "/usr/local/www/apache22/data/", line 3, in <module>

class Poll(models.Model):

File "/usr/local/www/apache22/data/", 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 !

Change History (1)

comment:1 Changed 11 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top