Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use a set instead of a list to prevent duplicates

  • Loading branch information...
commit 6532c6e52464489f75452c96b8b8d775bd859ae6 1 parent d9fe1b2
@paltman authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 nashvegas/management/commands/upgradedb.py
View
15 nashvegas/management/commands/upgradedb.py
@@ -160,7 +160,7 @@ def execute_migrations(self, show_traceback=False):
if not len(migrations):
sys.stdout.write("There are no migrations to apply.\n")
- created_models = []
+ created_models = set()
try:
for migration in migrations:
@@ -189,12 +189,13 @@ def execute_migrations(self, show_traceback=False):
else:
sys.stdout.write("success\n")
- created_models.extend([
- get_model(
- *l.replace("### New Model: ", "").strip().split(".")
- )
- for l in lines if l.startswith("### New Model: ")
- ])
+ for l in lines:
+ if l.startswith("### New Model: "):
+ created_models.add(
+ get_model(
+ *l.replace("### New Model: ", "").strip().split(".")
+ )
+ )
elif migration_path.endswith(".py"):
sys.stdout.write("Executing %s... " % migration)
Please sign in to comment.
Something went wrong with that request. Please try again.