def handle(self, *args, **options):
        db = settings.DATABASES['default']
        db_engine = db['ENGINE'].split(".")[-1]
        db['ENGINE'] = db_engine

        if db.get('PASSWORD'):
            db["PASSWORD"] = ":{0}".format(db.get('PASSWORD'))

        if db_engine == "postgresql_psycopg2":
            db['ENGINE'] = "postgresql"
            db['PORT'] = db.get('PORT') or 5432
        elif db_engine == "mysql":
            db['PORT'] = db.get('PORT') or 3306
        elif db_engine == "sqlite3":
            db['ENGINE'] = "sqlite"

        conn_string = u"{0}://{1}{2}@{3}:{4}/{5}".format(
            db['ENGINE'], db['USER'], db['PASSWORD'], db['HOST'], db['PORT'],
            db['NAME'])

        conn_name = u"Django default {0}".format(conn_string)

        conn_slug = self.mining_save(
            "{0}/api/connection".format(settings.REPORT_URL),
            {"name": conn_name, "connection": conn_string},
            conn_name)

        for m in self.collect_report():
            name = u"{0}.{1}".format(m.model.__module__, m.model.__name__)
            data = {"connection": conn_slug,
                    "name": name,
                    "scheduler_status": False,
                    "sql": m.query.__str__(),
                    "type": "relational"}
            print self.mining_save("{0}/api/cube".format(settings.REPORT_URL),
                                   data, name)
Admin user can authenticate with django via the html frontend
dataset/ETHPy150Open mining/django-report/report/management/commands/update_report.py/Command.handle--crossover with--dataset/ETHPy150Open django-oscar/django-oscar-api/oscarapi/tests/testuser.py/UserTest.test_admin_user