python - Django 1.5 - adding base class for models and views -


i trying add base class models defined in different apps. created package lib/base.py:

from django.db import models import logging  # instance of logger logger = logging.getlogger(__name__)  class base(models.model):  class meta:         abstract = true 

now in different home apps directory, use base model:

from django.db import models libs.base import base # create models here. class home(base):     msg = models.charfield(max_length=100)      @classmethod     def create(cls, msg):         home = cls(msg=msg)         # book         return home 

when run server, following error:

 file "/users/.../home/models.py", line 2, in <module>     libs.base import base importerror: no module named libs.base 

i cannot find missing here?

you should append libs module installed apps of project:

settings.py:

... installed_apps = (     ...     'home',     ...     'libs', # add this! ) ... 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -