Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #21868: Don't die when seeing py3 namespace packages for mig dirs

  • Loading branch information...
commit 935e6c1dfc10808272bfda1bbda03bfee035f3dc 1 parent 11c0213
@andrewgodwin andrewgodwin authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 django/db/migrations/questioner.py
View
7 django/db/migrations/questioner.py
@@ -39,7 +39,12 @@ def ask_initial(self, app_label):
except ImportError:
return self.defaults.get("ask_initial", False)
else:
- filenames = os.listdir(os.path.dirname(migrations_module.__file__))
+ if hasattr(migrations_module, "__file__"):
+ filenames = os.listdir(os.path.dirname(migrations_module.__file__))
+ elif hasattr(migrations_module, "__path__"):
+ if len(migrations_module.__path__) > 1:
+ return False
+ filenames = os.listdir(list(migrations_module.__path__)[0])
return not any(x.endswith(".py") for x in filenames if x != "__init__.py")
def ask_not_null_addition(self, field_name, model_name):
Please sign in to comment.
Something went wrong with that request. Please try again.