Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6625e283
authored
Apr 03, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: add list_fields to all models
parent
006dcfa1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
one/admin.py
+11
-0
one/models.py
+2
-0
No files found.
one/admin.py
View file @
6625e283
...
...
@@ -98,8 +98,19 @@ class InstanceAdmin(contrib.admin.ModelAdmin):
class
DiskAdmin
(
contrib
.
admin
.
ModelAdmin
):
model
=
models
.
Disk
list_display
=
(
'name'
,
'used_by'
)
def
used_by
(
self
,
obj
):
try
:
return
", "
.
join
(
obj
.
template_set
.
all
())
except
:
return
None
used_by
.
verbose_name
=
_
(
'used by'
)
class
NetworkAdmin
(
contrib
.
admin
.
ModelAdmin
):
model
=
models
.
Network
list_display
=
(
'name'
,
'nat'
,
'public'
,
'get_vlan'
)
class
ShareAdmin
(
contrib
.
admin
.
ModelAdmin
):
model
=
models
.
Network
list_filter
=
(
'group'
,
'template'
,
)
...
...
one/models.py
View file @
6625e283
...
...
@@ -300,6 +300,8 @@ class Network(models.Model):
Network
(
id
=
id
,
name
=
name
)
.
save
()
l
.
append
(
id
)
Network
.
objects
.
exclude
(
id__in
=
l
)
.
delete
()
def
get_vlan
(
self
):
return
Vlan
.
objects
.
get
(
vid
=
self
.
id
)
class
InstanceType
(
models
.
Model
):
...
...
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