Gitlab CSE Unil
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
M. Chardon
ADIM
Commits
e2903049
Commit
e2903049
authored
Mar 19, 2018
by
M. Chardon
Browse files
correction commande de nettoyage
parent
d5f0d036
Changes
1
Hide whitespace changes
Inline
Side-by-side
adim_project/adim/management/commands/adim_cleanup.py
View file @
e2903049
from
django.core.management.base
import
CommandError
,
NoArgs
Command
from
django.core.management.base
import
CommandError
,
Base
Command
from
django.conf
import
settings
from
adim.models
import
AnObj
import
os
...
...
@@ -6,19 +6,28 @@ import sys
from
optparse
import
make_option
class
Command
(
NoArgs
Command
):
class
Command
(
Base
Command
):
help
=
'Remove image files not used by an Annotable Object'
option_list
=
NoArgsCommand
.
option_list
+
(
make_option
(
'--noinput'
,
action
=
'store_false'
,
dest
=
'interactive'
,
default
=
True
,
help
=
"Do NOT prompt the user for input of any kind."
),
make_option
(
'-n'
,
'--dry-run'
,
action
=
'store_true'
,
dest
=
'dry_run'
,
default
=
False
,
help
=
"Do everything except modify the filesystem."
),
)
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
'--noinput'
,
action
=
'store_false'
,
dest
=
'interactive'
,
default
=
True
,
help
=
"Do NOT prompt the user for input of any kind."
)
parser
.
add_argument
(
'-n'
,
'--dry-run'
,
action
=
'store_true'
,
dest
=
'dry_run'
,
default
=
False
,
help
=
"Do everything except modify the filesystem."
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
NoArgs
Command
,
self
).
__init__
(
*
args
,
**
kwargs
)
super
(
Command
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
dry_run
=
False
self
.
interactive
=
True
self
.
verbosity
=
1
...
...
@@ -31,7 +40,7 @@ class Command(NoArgsCommand):
self
.
dry_run
=
options
[
'dry_run'
]
self
.
verbosity
=
int
(
options
[
'verbosity'
])
if
self
.
interactive
else
0
def
handle
_noargs
(
self
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
self
.
set_options
(
**
options
)
anobj_uuid_list
=
AnObj
.
objects
.
all
().
values_list
(
'uuid'
,
flat
=
True
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment