Skip to content
Permalink
Browse files

More load_flashcards speed-up

  • Loading branch information...
slaweet committed Oct 29, 2016
1 parent 4df41fb commit 714ddb30975b24e947be5c455c0cf1d3a2c5cf53
Showing with 2 additions and 2 deletions.
  1. +2 −2 proso_flashcards/management/commands/load_flashcards.py
@@ -72,7 +72,7 @@ def _load_categories(self, data=None):
for category in progress.bar(data, every=max(1, len(data) // 100)):
langs = [k[-2:] for k in category.keys() if re.match(r'^name-\w\w$', k)]
for lang in langs:
db_category = Category.objects.filter(identifier=category["id"], lang=lang).first()
db_category = db_categories.get((category["id"], lang))
if db_category is None:
db_category = Category(
identifier=category["id"],
@@ -107,7 +107,7 @@ def _load_contexts(self, data=None):
for context in progress.bar(data, every=max(1, len(data) // 100)):
langs = [k[-2:] for k in list(context.keys()) if re.match(r'^name-\w\w$', k)]
for lang in langs:
db_context = model.objects.filter(identifier=context["id"], lang=lang).first()
db_context = self.db_contexts.get((context["id"], lang))
if db_context is None:
db_context = model(
identifier=context["id"],

0 comments on commit 714ddb3

Please sign in to comment.
You can’t perform that action at this time.