Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
9ca7149a
Commit
9ca7149a
authored
Dec 11, 2012
by
Sofia Papagiannaki
Browse files
Update project-list command
parent
c46043b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/management/commands/project-list.py
View file @
9ca7149a
...
...
@@ -36,7 +36,7 @@ from optparse import make_option
from
django.core.management.base
import
NoArgsCommand
from
astakos.im.models
import
ProjectApplication
from
._common
import
format_bool
class
Command
(
NoArgsCommand
):
help
=
"List resources"
...
...
@@ -52,8 +52,11 @@ class Command(NoArgsCommand):
def
handle_noargs
(
self
,
**
options
):
apps
=
ProjectApplication
.
objects
.
select_related
().
all
()
labels
=
(
'application.id'
,
'project.id'
,
'name'
,
'state'
)
columns
=
(
15
,
10
,
20
,
10
)
labels
=
(
'application.id'
,
'project.id'
,
'name'
,
'application.state'
,
'is_active'
,
'is_alive'
,
'is_suspended'
,
'is_terminated'
)
columns
=
(
15
,
10
,
20
,
10
,
10
,
10
,
10
,
10
)
if
not
options
[
'csv'
]:
line
=
' '
.
join
(
l
.
rjust
(
w
)
for
l
,
w
in
zip
(
labels
,
columns
))
...
...
@@ -64,13 +67,25 @@ class Command(NoArgsCommand):
for
app
in
apps
:
try
:
project_id
=
str
(
app
.
project
.
id
)
is_active
=
app
.
project
.
is_active
is_alive
=
app
.
project
.
is_alive
is_suspended
=
app
.
project
.
is_suspended
is_terminated
=
app
.
project
.
is_terminated
except
:
project_id
=
''
is_active
=
''
is_alive
=
''
is_suspended
=
''
is_terminated
=
''
fields
=
(
str
(
app
.
id
),
str
(
project_id
),
app
.
definition
.
name
,
app
.
state
app
.
state
,
format_bool
(
is_active
),
format_bool
(
is_alive
),
format_bool
(
is_suspended
),
format_bool
(
is_terminated
)
)
if
options
[
'csv'
]:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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