i can't import newforms(newbie)

949 views
Skip to first unread message

refreegrata

unread,
Jun 8, 2010, 3:46:46 PM6/8/10
to Django users
hello list
i'm a newbie with django trying to learn
Now i have a question
when i do
-------------------------------------------------------
from django import newforms as forms
--------------------------------------------------------
django throw an exception : "Error was: cannot import name newforms"

But when i do
-------------------------------------------------------
from django import forms
-------------------------------------------------------
all works fine

Mi question is, in all tutorial that i read, the writter say something
like "the recommended way to import is 'from django import newforms as
forms'".

Why this way don't work now?.In the last version of Django newforms
was replaced for form?. I can't find nothing in the official
documention.

Mi PC have Django 1.2.1(the latest stable version)

That's my question. Thank's all. And sorry for my poor english, the
english isn't my mother language.

Michael

unread,
Jun 8, 2010, 3:50:33 PM6/8/10
to django...@googlegroups.com
The tutorial you read was for a django before 1.0. django.newforms was moved to django.forms for that release. If you see newforms in a tutorial, you can assume those are just forms now.

Hope that helps,

Michael

Dan Harris

unread,
Jun 8, 2010, 3:53:48 PM6/8/10
to Django users
Hey there,

newforms was renamed to forms for the Django 1.0 release, this is the
reason why the statement "from django import newforms as forms"
doesn't work (because newforms does not exist anymore). Anywhere you
see newforms you can probably replace with forms. What tutorials are
you reading? If they are the official Django tutorials that is most
likely a bug in the documentation.

The documentation on the deprecation of newforms in favor of form is
in the Django 1.0 release notes at: http://docs.djangoproject.com/en/dev/releases/1.0/

Cheers,

Dan Harris
dih...@gmail.com

Steven L Smith

unread,
Jun 8, 2010, 3:53:41 PM6/8/10
to django...@googlegroups.com
Hello, and welcome to Django.

A long time ago, the original "forms" was removed and replaced with
"newforms". To keep applications working during the transition, both "forms"
and "newforms" were kept side-by-side for awhile. The idea was, after the
transition was complete, you could simply change "import newforms as forms" to
"import forms" and it would continue working.

So, yes, anytime you see "import newforms as forms" it is safe to replace it
with "import forms".

====================================
Steven L Smith, Web Developer
Department of Information Technology Services
Nazareth College of Rochester
585-389-2085 | ssmi...@naz.edu
http://www.naz.edu/pub/~ssmith46
====================================

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to
django-users...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.

refreegrata

unread,
Jun 8, 2010, 3:58:27 PM6/8/10
to Django users
ok, thanks. Now I feel more relaxed.

On 8 jun, 15:50, Michael <newmani...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages