diff --git a/chunked_upload/management/commands/delete_expired_uploads.py b/chunked_upload/management/commands/delete_expired_uploads.py index 2f5fc1d..a844fe3 100644 --- a/chunked_upload/management/commands/delete_expired_uploads.py +++ b/chunked_upload/management/commands/delete_expired_uploads.py @@ -1,8 +1,6 @@ -from optparse import make_option - from django.core.management.base import BaseCommand from django.utils import timezone -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from chunked_upload.settings import EXPIRATION_DELTA from chunked_upload.models import ChunkedUpload @@ -18,13 +16,15 @@ class Command(BaseCommand): help = 'Deletes chunked uploads that have already expired.' - option_list = BaseCommand.option_list + ( - make_option('--interactive', - action='store_true', - dest='interactive', - default=False, - help='Prompt confirmation before each deletion.'), - ) + def add_arguments(self, parser): + super().add_arguments(parser) + parser.add_argument( + '--interactive', + action='store_true', + dest='interactive', + default=False, + help='Prompt confirmation before each deletion.', + ) def handle(self, *args, **options): interactive = options.get('interactive') @@ -36,9 +36,9 @@ def handle(self, *args, **options): for chunked_upload in qs: if interactive: prompt = prompt_msg.format(obj=chunked_upload) + u' (y/n): ' - answer = raw_input(prompt).lower() + answer = input(prompt).lower() while answer not in ('y', 'n'): - answer = raw_input(prompt).lower() + answer = input(prompt).lower() if answer == 'n': continue diff --git a/setup.py b/setup.py index 8991022..a322b16 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ setup( name='django-chunked-upload', - packages=['chunked_upload', 'chunked_upload.migrations', 'chunked_upload.management'], + packages=['chunked_upload', 'chunked_upload.migrations', 'chunked_upload.management', 'chunked_upload.management.commands'], version=version, description=('Upload large files to Django in multiple chunks, with the ' 'ability to resume if the upload is interrupted.'),