Minor improvements in the command 'generate_sha1'
parent
24cea7cc83
commit
f4b11b26fb
|
@ -3,10 +3,17 @@ from django.db import transaction
|
||||||
|
|
||||||
from taiga.projects.attachments.models import Attachment
|
from taiga.projects.attachments.models import Attachment
|
||||||
|
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
for attachment in Attachment.objects.all():
|
total = rest = Attachment.objects.all().count()
|
||||||
|
|
||||||
|
for attachment in Attachment.objects.all().order_by("id"):
|
||||||
attachment.save()
|
attachment.save()
|
||||||
|
|
||||||
|
rest -= 1
|
||||||
|
logger.debug("[{} / {} remaining] - Generate sha1 for attach {}".format(rest, total, attachment.id))
|
||||||
|
|
Loading…
Reference in New Issue