newbie help

4 views
Skip to first unread message

Mario Zorz

unread,
Jul 14, 2008, 6:46:23 PM7/14/08
to django...@googlegroups.com
Hello all,

I'm following the Django tutorial [1] I'm using windows xp, python 2.5 and SQLite. For some reason I found these 2 things not being appropiate as followed in the tutorial:

1) When tried "python manage.py sql polls" I got this
TypeError: __init__() got an unexpected keyword argument 'max_length'.

I could only run it successfully by changing the linea
    question = models.CharField(max_length=200)
to
    question = models.CharField(maxlength=200)
(stripped off the undrescore in "max_length")

2) Continuing down to the "Playing with the API" section, and once I saved some poll objects to the DB, etc I executed the following command as specified in the tutorial:
Poll.objects.all()

For some reason, the result I get from the shell is
>>> Poll.objects.all()
[<Poll: Poll object>]


Even when I inserted the __unicode__() method in models.py as follows:
class Poll(models.Model):
    question = models.CharField(maxlength=200)
    pub_date = models.DateTimeField('date published')
    def __unicode__(self):
        return self.question

Anything I'm doing wrong?
Thanks a lot
regards
Mario

[1] http://www.djangoproject.com/documentation/tutorial01/

Matt McClanahan

unread,
Jul 14, 2008, 10:18:52 PM7/14/08
to Django users
On Jul 14, 3:46 pm, Mario Zorz <marionetaz...@yahoo.com> wrote:
> Hello all,
>
> I'm following the Django tutorial [1] I'm using windows xp, python 2.5 and SQLite. For some reason I found these 2 things not being appropiate as followed in the tutorial:
>
> 1) When tried "python manage.py sql polls" I got this
> TypeError: __init__() got an unexpected keyword argument 'max_length'.

> 2) Continuing down to the "Playing with the API" section, and once I saved some poll objects to the DB, etc I executed the following command as specified in the tutorial:

You are attempting to use the tutorial that targets current
development code with one of the Django releases (0.95, 0.96..). As
the tutorial notes in several places, there are differences between
the releases and current development. In fact, both of the problems
you've encountered are specifically addressed in the document you
linked to.

You should either fetch the development version of Django, or use the
tutorial targeted for your Django version, which are linked at the top
of each documentation page.

Matt

Joshua Jonah

unread,
Jul 14, 2008, 10:58:18 PM7/14/08
to django...@googlegroups.com
maxlength was changed in the trunk to max_length. You are probably using an older version of Django, the tutorial you were following refers to the latest version:
http://code.djangoproject.com/ticket/6457

As for the returning the text thing, same deal. If you go to this page: http://www.djangoproject.com/documentation/tutorial01/ and look at where it explains to do that, it has a little note below it explaining that this wil happen in the older version.

If i were you, I'd either upgrade your Django, or start following the 0.96 tutorial from here.

Joshua

Joshua Jonah

unread,
Jul 14, 2008, 11:01:06 PM7/14/08
to django...@googlegroups.com
Sorry, hadn't gotten new mail in a while :D

Mario Zorz

unread,
Jul 15, 2008, 12:27:20 PM7/15/08
to django...@googlegroups.com
thanks a lot Matt!

I'll fetch the dev version of Django instead.
I guess I was confused by the phrases "SVN release" and  "official release". I just thought the SVN release would be the official release :p

Thanks a log again

----- Original Message ----
From: Matt McClanahan <matt.mc...@gmail.com>
To: Django users <django...@googlegroups.com>
Sent: Monday, July 14, 2008 11:18:52 PM
Subject: Re: newbie help



On Jul 14, 3:46 pm, Mario Zorz <marionetaz...@yahoo.com> wrote:
> Hello all,
>
> I'm following the Django tutorial [1] I'm using windows xp, python 2.5 and SQLite. For some reason I found these 2 things not being appropiate as followed in the tutorial:
>
> 1) When tried "python manage.py sql polls" I got this
> TypeError: __init__() got an unexpected keyword argument 'max_length'.

> 2) Continuing down to the "Playing with the API" section, and once I saved some poll objects to the DB, etc I executed the following command as specified in the tutorial:

Mario Zorz

unread,
Jul 15, 2008, 12:27:44 PM7/15/08
to django...@googlegroups.com
Thanks Joshua!

I'll fetch the dev version of Django instead.
I guess I was confused by the phrases "SVN release" and  "official release". I just thought the SVN release would be the official release :p

Thanks a log again

----- Original Message ----
From: Joshua Jonah <jo...@joshuajonah.com>
To: django...@googlegroups.com
Sent: Monday, July 14, 2008 11:58:18 PM
Subject: Re: newbie help

maxlength was changed in the trunk to max_length. You are probably using an older version of Django, the tutorial you were following refers to the latest version:
http://code.djangoproject.com/ticket/6457

As for the returning the text thing, same deal. If you go to this page: http://www.djangoproject.com/documentation/tutorial01/ and look at where it explains to do that, it has a little note below it explaining that this wil happen in the older version.

If i were you, I'd either upgrade your Django, or start following the 0.96 tutorial from here.

Joshua

Mario Zorz wrote:
Hello all,

I'm following the Django tutorial [1] I'm using windows xp, python 2.5 and SQLite. For some reason I found these 2 things not being appropiate as followed in the tutorial:

1) When tried "python manage.py sql polls" I got this
TypeError: __init__() got an unexpected keyword argument 'max_length'.

I could only run it successfully by changing the linea
    question = models.CharField(max_length=200)
to
    question = models.CharField(maxlength=200)
(stripped off the undrescore in "max_length")

2) Continuing down to the "Playing with the API" section, and once I saved some poll objects to the DB, etc I executed the following command as specified in the tutorial:
Poll.objects.all()

Reply all
Reply to author
Forward
0 new messages