Show More
@@ -1,20 +1,22 b'' | |||
|
1 | 1 | from django.core.management import BaseCommand |
|
2 | 2 | from django.db import transaction |
|
3 | 3 | |
|
4 | 4 | from boards.models import GlobalId |
|
5 | 5 | |
|
6 | 6 | __author__ = 'neko259' |
|
7 | 7 | |
|
8 | 8 | |
|
9 | 9 | class Command(BaseCommand): |
|
10 | 10 | help = 'Removes local global ID cache' |
|
11 | 11 | |
|
12 | 12 | @transaction.atomic |
|
13 | 13 | def handle(self, *args, **options): |
|
14 | 14 | count = 0 |
|
15 |
for global_id in GlobalId.objects. |
|
|
15 | for global_id in GlobalId.objects.exclude(content__isnull=True).exclude( | |
|
16 | content=''): | |
|
16 | 17 | if global_id.is_local() and global_id.content is not None: |
|
17 | 18 | global_id.content = None |
|
18 | 19 | global_id.save() |
|
20 | global_id.signature_set.all().delete() | |
|
19 | 21 | count += 1 |
|
20 | 22 | print('Invalidated {} caches.'.format(count)) |
General Comments 0
You need to be logged in to leave comments.
Login now