invalidate_sync_cache.py
20 lines
| 572 B
| text/x-python
|
PythonLexer
neko259
|
r1560 | from django.core.management import BaseCommand | ||
from django.db import transaction | ||||
from boards.models import GlobalId | ||||
__author__ = 'neko259' | ||||
class Command(BaseCommand): | ||||
help = 'Removes local global ID cache' | ||||
@transaction.atomic | ||||
def handle(self, *args, **options): | ||||
count = 0 | ||||
for global_id in GlobalId.objects.all(): | ||||
if global_id.is_local() and global_id.content is not None: | ||||
global_id.content = None | ||||
global_id.save() | ||||
count += 1 | ||||
print('Invalidated {} caches.'.format(count)) | ||||