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
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
@transaction.atomic
|
||||
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()
|
||||
|
||||
rest -= 1
|
||||
logger.debug("[{} / {} remaining] - Generate sha1 for attach {}".format(rest, total, attachment.id))
|
||||
|
|
Loading…
Reference in New Issue