Tuesday, April 27, 2010

DJango Models

somehow i prefer to group all my models in one folder, however in django when u create your app, the models is inside your app folder.

# python manage.py startapp dummy
# ls dummy
__init__.py models.py tests.py views.py

in order put all apps models in a single folder structure what u need to do is as follow:

# create your model folder inside your project - i named it models
 mkdir models

# edit your models and add a meta class a follow 
class Meta:
    app_label = "appName"

# and import it your models in models/__init__.py file
from modelfile import yourmodel



No comments: