Commit 19bd2854 by Őry Máté

vm: set natural ordering for nodes

parent fec342df
...@@ -66,7 +66,8 @@ class NodeListTable(Table): ...@@ -66,7 +66,8 @@ class NodeListTable(Table):
) )
name = TemplateColumn( name = TemplateColumn(
template_name="dashboard/node-list/column-name.html" template_name="dashboard/node-list/column-name.html",
order_by="normalized_name"
) )
priority = Column( priority = Column(
......
...@@ -11,7 +11,7 @@ from celery.exceptions import TimeoutError ...@@ -11,7 +11,7 @@ from celery.exceptions import TimeoutError
from model_utils.models import TimeStampedModel from model_utils.models import TimeStampedModel
from taggit.managers import TaggableManager 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 firewall.models import Host
from ..tasks import vm_tasks from ..tasks import vm_tasks
from .common import Trait from .common import Trait
...@@ -43,6 +43,7 @@ class Node(TimeStampedModel): ...@@ -43,6 +43,7 @@ class Node(TimeStampedModel):
name = CharField(max_length=50, unique=True, name = CharField(max_length=50, unique=True,
verbose_name=_('name'), verbose_name=_('name'),
help_text=_('Human readable name of node.')) help_text=_('Human readable name of node.'))
normalized_name = HumanSortField(monitor='name', max_length=100)
priority = IntegerField(verbose_name=_('priority'), priority = IntegerField(verbose_name=_('priority'),
help_text=_('Node usage priority.')) help_text=_('Node usage priority.'))
host = ForeignKey(Host, verbose_name=_('host'), host = ForeignKey(Host, verbose_name=_('host'),
...@@ -62,6 +63,7 @@ class Node(TimeStampedModel): ...@@ -62,6 +63,7 @@ class Node(TimeStampedModel):
app_label = 'vm' app_label = 'vm'
db_table = 'vm_node' db_table = 'vm_node'
permissions = () permissions = ()
ordering = ('-enabled', 'normalized_name')
def __unicode__(self): def __unicode__(self):
return self.name 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