# Case Conductor is a Test Case Management system.
# Copyright (C) 2011-2012 Mozilla
# 
# This file is part of Case Conductor.
# 
# Case Conductor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# Case Conductor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Case Conductor.  If not, see <http://www.gnu.org/licenses/>.
"""
Makes IPython import all of your projects models when shell is started.

1. Save as ipy_user_conf.py in project root
2. ./manage.py shell
3. profit

"""

import IPython.ipapi
ip = IPython.ipapi.get()


def main():
    print "\nImported:\n\n"

    imports = [
        "import datetime",
        "from django.contrib.auth.models import User, Group, Permission",
        "from cc.core.models import Product, ProductVersion",
        "from cc.library.models import Suite, Case, CaseVersion, CaseStep, CaseAttachment, SuiteCase",
        "from cc.execution.models import Run, RunCaseVersion, RunSuite, Result, StepResult",
        "from cc.environments.models import Profile, Category, Element, Environment",
        "from cc.tags.models import Tag",
        ]

    for imp in imports:
        ip.ex(imp)
        print imp

    print "\n"

main()

@@ -1146,16 +1146,22 @@
 from cc.
+model.
 core.mod
@@ -1214,16 +1214,22 @@
 from cc.
+model.
 library.
@@ -1323,16 +1323,22 @@
 from cc.
+model.
 executio
@@ -1422,16 +1422,22 @@
 from cc.
+model.
 environm
@@ -1514,16 +1514,22 @@
 from cc.
+model.
 tags.mod

Update model auto-imports for new structure.