On Wed, Oct 28, 2009 at 12:50 PM, Vincent Jones <jones...@gmail.com> wrote:

> Thats what i don't understand.....i am trying to learn django
> using"Learning Website development with django" when i get to the step of
> using models it gives me the second script below and says to insert the top
> script and after i type ' python manage.py syncdb i get an *NameError :
> name 'models' is not defined
>
> *


It sounds like you've put the bookmarks block at the very top of your
existing models.py file that had already included the Link model.  That
won't work because the Bookmark class definition:

class Bookmark(models.Model):

references the models module which is not imported until further down, right
before the Link model definition:

from django.db import models
class Link(models.Model):

(The code you included in your first message is also entirely lacking a
bunch of required indentation -- I presume it is really there in the file
you are woking with?  Indentation is significant in Python so leaving it out
when posting can cause confusion.  Leaving it out in the file you are
working with will lead to errors.)

The fix for the error message you are getting is to move the import for
models to be above any reference to the models module.

More broadly, this is basic Python knowledge.  If you are brand new to
Python as well as Django you might want to start by working through a plain
Python tutorial.  It's possible to learn both at the same time, but it
really helps if you cover learning the very basics of Python first.

Karen

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

Reply via email to