Moved an import to function body to allow installing tenancy even if django is not installed yet