Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1df0e6ed
authored
Nov 20, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add model manager for active instances
parent
dd05833f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
circle/dashboard/views.py
+1
-1
circle/vm/models.py
+9
-1
No files found.
circle/dashboard/views.py
View file @
1df0e6ed
...
@@ -206,7 +206,7 @@ class TemplateDetail(DetailView):
...
@@ -206,7 +206,7 @@ class TemplateDetail(DetailView):
class
VmList
(
SingleTableView
):
class
VmList
(
SingleTableView
):
template_name
=
"dashboard/vm-list.html"
template_name
=
"dashboard/vm-list.html"
model
=
Instance
queryset
=
Instance
.
active
.
all
()
table_class
=
VmListTable
table_class
=
VmListTable
table_pagination
=
False
table_pagination
=
False
...
...
circle/vm/models.py
View file @
1df0e6ed
...
@@ -9,7 +9,7 @@ from django.contrib.auth.models import User
...
@@ -9,7 +9,7 @@ from django.contrib.auth.models import User
from
django.core
import
signing
from
django.core
import
signing
from
django.db.models
import
(
Model
,
ForeignKey
,
ManyToManyField
,
IntegerField
,
from
django.db.models
import
(
Model
,
ForeignKey
,
ManyToManyField
,
IntegerField
,
DateTimeField
,
BooleanField
,
TextField
,
DateTimeField
,
BooleanField
,
TextField
,
CharField
,
permalink
)
CharField
,
permalink
,
Manager
)
from
django.utils
import
timezone
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
...
@@ -34,6 +34,12 @@ ARCHITECTURES = (('x86_64', 'x86-64 (64 bit)'),
...
@@ -34,6 +34,12 @@ ARCHITECTURES = (('x86_64', 'x86-64 (64 bit)'),
VNC_PORT_RANGE
=
(
2000
,
65536
)
# inclusive start, exclusive end
VNC_PORT_RANGE
=
(
2000
,
65536
)
# inclusive start, exclusive end
class
InstanceActiveManager
(
Manager
):
def
get_query_set
(
self
):
return
super
(
InstanceActiveManager
,
self
)
.
get_query_set
()
.
filter
(
destroyed
=
None
)
class
BaseResourceConfigModel
(
Model
):
class
BaseResourceConfigModel
(
Model
):
"""Abstract base for models with base resource configuration parameters.
"""Abstract base for models with base resource configuration parameters.
...
@@ -413,6 +419,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -413,6 +419,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
destroyed
=
DateTimeField
(
blank
=
True
,
null
=
True
,
destroyed
=
DateTimeField
(
blank
=
True
,
null
=
True
,
help_text
=
_
(
"The virtual machine's time of "
help_text
=
_
(
"The virtual machine's time of "
"destruction."
))
"destruction."
))
objects
=
Manager
()
active
=
InstanceActiveManager
()
class
Meta
:
class
Meta
:
ordering
=
[
'pk'
,
]
ordering
=
[
'pk'
,
]
...
...
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