X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c7c0b88f1f628f0498c8c53c76a061ec128a228a..472845d4dba67935e4f5bbbfa07b54b23921dab5:/apps/catalogue/utils.py diff --git a/apps/catalogue/utils.py b/apps/catalogue/utils.py index edc287f98..33b0830e7 100644 --- a/apps/catalogue/utils.py +++ b/apps/catalogue/utils.py @@ -38,8 +38,12 @@ def get_random_hash(seed): return urlsafe_b64encode(sha_digest).replace('=', '').replace('_', '-').lower() -def split_tags(tags): - result = {} +def split_tags(tags, initial=None): + if initial is None: + result = {} + else: + result = initial + for tag in tags: result.setdefault(tag.category, []).append(tag) return result