Commit 19bd2854 by Őry Máté

vm: set natural ordering for nodes

parent fec342df
......@@ -66,7 +66,8 @@ class NodeListTable(Table):
)
name = TemplateColumn(
template_name="dashboard/node-list/column-name.html"
template_name="dashboard/node-list/column-name.html",
order_by="normalized_name"
)
priority = Column(
......
......@@ -11,7 +11,7 @@ from celery.exceptions import TimeoutError
from model_utils.models import TimeStampedModel
from taggit.managers import TaggableManager
from common.models import method_cache, WorkerNotFound
from common.models import method_cache, WorkerNotFound, HumanSortField
from firewall.models import Host
from ..tasks import vm_tasks
from .common import Trait
......@@ -43,6 +43,7 @@ class Node(TimeStampedModel):
name = CharField(max_length=50, unique=True,
verbose_name=_('name'),
help_text=_('Human readable name of node.'))
normalized_name = HumanSortField(monitor='name', max_length=100)
priority = IntegerField(verbose_name=_('priority'),
help_text=_('Node usage priority.'))
host = ForeignKey(Host, verbose_name=_('host'),
......@@ -62,6 +63,7 @@ class Node(TimeStampedModel):
app_label = 'vm'
db_table = 'vm_node'
permissions = ()
ordering = ('-enabled', 'normalized_name')
def __unicode__(self):
return self.name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment