'from django.db import models' means that from the django.db namespace, import the models module.
If it had been 'from django.db.models import *' then you can write: class Publisher(Model): name = CharField(max_length = 30) ...because you've actually imported all of the objects _under_ the django.db.models namespace. A better explanation than I can give about modules is in the Python tutorial at http://www.python.org/doc/2.0.1/tut/node8.html Hopefully that helps, Eric Florenzano On Dec 27, 1:55 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I am looking for an explanation of what "from django.db import models" > does. > In the django book, there is an example like this: > > from django.db import models > > class Publisher(models.Model): > name = models.CharField(maxlength = 30) > ..... > > I thought that by "from django.db import models" I am importing > everything, including Model.py, in the django.db.models directory; and > a Model.py which includes CharField() method is in this models > directory. But, there is no "Model.py" in the models directory. I > found the "Model" class in the base.py file, but Model class does not > have a "CharField()" method. > > Can someone explain what is happening in the code snippet above? > > Thanks in advance. > > YJ --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---