Skip to content

Commit

Permalink
Make management command compatible with latest Django and Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
chazapis committed Jun 25, 2021
1 parent 2d49a8c commit 7cbacca
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions chunked_upload/management/commands/delete_expired_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,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')
Expand All @@ -36,9 +38,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

Expand Down

0 comments on commit 7cbacca

Please sign in to comment.