After I finished tutorials I wanted to start playing with my own
application. So I created my new project called
 shopproject
 and  defined my model like this

############shop.py#############
from django.core import meta

class Registration(meta.Model):
    fields = (
        meta.CharField('Login', maxlength=50,unique=True),
        meta.CharField('Password', maxlength=50),
        meta.EmailField('Email'),
        meta.CharField('InvoicingName', maxlength=100),
        meta.CharField('InvoicingAddress', maxlength=200),
        meta.CharField('InvoicingZip', maxlength=200),
        meta.CharField('PostalName', maxlength=100),
        meta.CharField('PostalAddress', maxlength=200),
        meta.CharField('PostalZip', maxlength=200),
        meta.DateTimeField('Date_joined', default=meta.LazyDate()),
    )
    #def __repr__(self):
    #    return self.question

    admin = meta.Admin(
    list_display = ('Login', 'Password', 'Email','InvoicingName'),
    list_filter = ['Date_joined'],
    search_fields = ['Login'],
    date_hierarchy = 'Date_joined'
    )

###############

And my main.py looks like this

#########main.py################
# Django settings for shopproject project.

DEBUG = True

ADMINS = (
    # ('Your Name', '[EMAIL PROTECTED]'),
)

MANAGERS = ADMINS

LANGUAGE_CODE = 'en-us'

DATABASE_ENGINE = 'mysql' # 'postgresql', 'mysql', or 'sqlite3'.
DATABASE_NAME = 'shop'             # Or path to database file if using
sqlite3.
DATABASE_USER = ''             # Not used with sqlite3.
DATABASE_PASSWORD = ''         # Not used with sqlite3.
DATABASE_HOST = ''             # Set to empty string for localhost. Not
used with sqlite3.

SITE_ID = 1

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com";
MEDIA_URL = ''

# Make this unique, and don't share it with anybody.
SECRET_KEY = '[EMAIL PROTECTED]@@[EMAIL PROTECTED]))99u2=y&f3it!t&^x_3+'

MIDDLEWARE_CLASSES = (
    "django.middleware.common.CommonMiddleware",
    "django.middleware.doc.XViewMiddleware",
)

ROOT_URLCONF = 'shopproject.settings.urls.main'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates".
)

INSTALLED_APPS = ('shopproject.apps.shop',
)
#########################

I installed that model.

I can use that model with Admin site - it works, but can not use it
from Python intractive shell.
When I try to import the model like

from django.models.shop import *

 I  get this import error :
ImportError: No module named shop

but

import shopproject.apps.shop

works.

But why? Can anyone help? Thank you.
L.

Reply via email to