Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Use new add_argument method

Roland Geider21d948c080a9
diff --git a/wger/core/management/commands/clear-cache.py b/wger/core/management/commands/clear-cache.py
index 9d3c4d1b9..130f5e541 100644
--- a/wger/core/management/commands/clear-cache.py
+++ b/wger/core/management/commands/clear-cache.py
@@ -34,29 +34,29 @@ class Command(BaseCommand):
Clears caches (HTML, etc.)
'''
- option_list = BaseCommand.option_list + (
- make_option('--clear-template',
- action='store_true',
- dest='clear_template',
- default=False,
- help='Clear only template caches'),
-
- make_option('--clear-workout-cache',
- action='store_true',
- dest='clear_workout',
- default=False,
- help='Clear only the workout canonical view'),
-
- make_option('--clear-all',
- action='store_true',
- dest='clear_all',
- default=False,
- help='Clear ALL cached entries'),
- )
-
help = 'Clears the application cache. You *must* pass an option selecting ' \
'what exactly you want to clear. See available options.'
+ def add_arguments(self, parser):
+
+ parser.add_argument('--clear-template',
+ action='store_true',
+ dest='clear_template',
+ default=False,
+ help='Clear only template caches')
+
+ parser.add_argument('--clear-workout-cache',
+ action='store_true',
+ dest='clear_workout',
+ default=False,
+ help='Clear only the workout canonical view')
+
+ parser.add_argument('--clear-all',
+ action='store_true',
+ dest='clear_all',
+ default=False,
+ help='Clear ALL cached entries')
+
def handle(self, **options):
'''
Process the options
diff --git a/wger/exercises/management/commands/download-exercise-images.py b/wger/exercises/management/commands/download-exercise-images.py
index 403761a48..7c7e83bbe 100644
--- a/wger/exercises/management/commands/download-exercise-images.py
+++ b/wger/exercises/management/commands/download-exercise-images.py
@@ -40,14 +40,6 @@ class Command(BaseCommand):
Otherwise, the exercise is simply skipped
'''
- option_list = BaseCommand.option_list + (
- make_option('--remote-url',
- action='store',
- dest='remote_url',
- default='https://wger.de',
- help='Remote URL to fetch the exercises from (default: https://wger.de)'),
- )
-
help = ('Download exercise images from wger.de and update the local database\n'
'\n'
'ATTENTION: The script will download the images from the server and add them\n'
@@ -55,6 +47,13 @@ class Command(BaseCommand):
' their UUID field, if you manually edited or changed it\n'
' the script will not be able to match them.')
+ def add_arguments(self, parser):
+ parser.add_argument('--remote-url',
+ action='store',
+ dest='remote_url',
+ default='https://wger.de',
+ help='Remote URL to fetch the exercises from (default: https://wger.de)')
+
def handle(self, **options):
if not settings.MEDIA_ROOT: