X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/8c6cc2964921706791492e40267862db94db27dc..a89df185c654948f1c146972270aaccf2d982d38:/apps/api/management/commands/mobileinit.py diff --git a/apps/api/management/commands/mobileinit.py b/apps/api/management/commands/mobileinit.py index 91ee3b624..57b41aa46 100755 --- a/apps/api/management/commands/mobileinit.py +++ b/apps/api/management/commands/mobileinit.py @@ -24,7 +24,7 @@ class Command(BaseCommand): for b in Book.objects.all(): add_book(db, b) for t in Tag.objects.exclude( - category__in=('book', 'set', 'theme')).exclude(book_count=0): + category__in=('book', 'set', 'theme')).exclude(items=None): # only add non-empty tags add_tag(db, t) db.commit() @@ -58,7 +58,7 @@ def pretty_size(size): value = re.sub('[^a-zA-Z0-9\\s\\-]{1}', replace_char, value) value = value.lower() value = re.sub(r'[^a-z0-9{|}]+', '~', value) - + return value.encode('ascii', 'ignore') @@ -113,7 +113,7 @@ def current(last_checked): 'initial.db-%d' % last_checked, target, ) - + book_sql = """ @@ -130,9 +130,9 @@ tag_sql = """ (:id, :category, :name, :sort_key, :book_ids); """ categories = {'author': 'autor', - 'epoch': 'epoka', - 'genre': 'gatunek', - 'kind': 'rodzaj', + 'epoch': 'epoka', + 'genre': 'gatunek', + 'kind': 'rodzaj', 'theme': 'motyw' } @@ -159,8 +159,7 @@ def add_book(db, book): def add_tag(db, tag): id = tag.id - # category = categories[tag.category] # localized names here? - category = tag.category + category = categories[tag.category] name = tag.name sort_key = tag.sort_key