X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/3726f9b225fb5c39cbf067f53d4cf6f7d8a9f326..472845d4dba67935e4f5bbbfa07b54b23921dab5:/apps/catalogue/utils.py?ds=inline 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