2 # -*- coding: utf-8 -*-
3 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
8 from django.core.management import setup_environ
9 from wolnelektury import settings
12 except AttributeError:
13 from set import Set as set
15 setup_environ(settings)
17 from catalogue import models
19 fragment_identifiers = set()
22 print 'Before: %d fragments' % models.Fragment.objects.count()
25 for fragment in models.Fragment.objects.all():
26 if (fragment.book_id, fragment.anchor) in fragment_identifiers:
30 fragment_identifiers.add((fragment.book_id, fragment.anchor))
34 print 'After: %d fragments' % models.Fragment.objects.count()