Commit 45cd15cd by Bach Dániel

Merge branch 'feature-default-ordering' into 'master'

Feature default ordering

See merge request !312
parents 833bb0b6 001fea56
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='connectcommand',
options={'ordering': ('id',)},
),
migrations.AlterModelOptions(
name='futuremember',
options={'ordering': ('id',)},
),
migrations.AlterModelOptions(
name='groupprofile',
options={'ordering': ('id',)},
),
migrations.AlterModelOptions(
name='profile',
options={'ordering': ('id',), 'permissions': (('use_autocomplete', 'Can use autocomplete.'),)},
),
]
...@@ -128,6 +128,9 @@ class ConnectCommand(Model): ...@@ -128,6 +128,9 @@ class ConnectCommand(Model):
'host, port.'), 'host, port.'),
validators=[connect_command_template_validator]) validators=[connect_command_template_validator])
class Meta:
ordering = ('id', )
def __unicode__(self): def __unicode__(self):
return self.template return self.template
...@@ -218,6 +221,7 @@ class Profile(Model): ...@@ -218,6 +221,7 @@ class Profile(Model):
super(Profile, self).save(*args, **kwargs) super(Profile, self).save(*args, **kwargs)
class Meta: class Meta:
ordering = ('id', )
permissions = ( permissions = (
('use_autocomplete', _('Can use autocomplete.')), ('use_autocomplete', _('Can use autocomplete.')),
) )
...@@ -229,6 +233,7 @@ class FutureMember(Model): ...@@ -229,6 +233,7 @@ class FutureMember(Model):
group = ForeignKey(Group) group = ForeignKey(Group)
class Meta: class Meta:
ordering = ('id', )
unique_together = ('org_id', 'group') unique_together = ('org_id', 'group')
def __unicode__(self): def __unicode__(self):
...@@ -247,6 +252,9 @@ class GroupProfile(AclBase): ...@@ -247,6 +252,9 @@ class GroupProfile(AclBase):
help_text=_('Unique identifier of the group at the organization.')) help_text=_('Unique identifier of the group at the organization.'))
description = TextField(blank=True) description = TextField(blank=True)
class Meta:
ordering = ('id', )
def __unicode__(self): def __unicode__(self):
return self.group.name return self.group.name
......
...@@ -149,6 +149,7 @@ class GroupListTable(Table): ...@@ -149,6 +149,7 @@ class GroupListTable(Table):
attrs = {'class': ('table table-bordered table-striped table-hover ' attrs = {'class': ('table table-bordered table-striped table-hover '
'group-list-table')} 'group-list-table')}
fields = ('pk', 'name', ) fields = ('pk', 'name', )
order_by = ('pk', )
class UserListTable(Table): class UserListTable(Table):
...@@ -176,6 +177,7 @@ class UserListTable(Table): ...@@ -176,6 +177,7 @@ class UserListTable(Table):
attrs = {'class': ('table table-bordered table-striped table-hover')} attrs = {'class': ('table table-bordered table-striped table-hover')}
fields = ('username', 'last_name', 'first_name', 'profile__org_id', fields = ('username', 'last_name', 'first_name', 'profile__org_id',
'email', 'is_active', 'is_superuser') 'email', 'is_active', 'is_superuser')
order_by = ('username', )
class TemplateListTable(Table): class TemplateListTable(Table):
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('firewall', '0003_auto_20150226_1927'),
]
operations = [
migrations.AlterModelOptions(
name='blacklistitem',
options={'ordering': ('id',), 'verbose_name': 'blacklist item', 'verbose_name_plural': 'blacklist items'},
),
migrations.AlterModelOptions(
name='domain',
options={'ordering': ('id',), 'verbose_name': 'domain', 'verbose_name_plural': 'domains'},
),
migrations.AlterModelOptions(
name='ethernetdevice',
options={'ordering': ('id',), 'verbose_name': 'ethernet device', 'verbose_name_plural': 'ethernet devices'},
),
migrations.AlterModelOptions(
name='firewall',
options={'ordering': ('id',), 'verbose_name': 'firewall', 'verbose_name_plural': 'firewalls'},
),
migrations.AlterModelOptions(
name='group',
options={'ordering': ('id',), 'verbose_name': 'host group', 'verbose_name_plural': 'host groups'},
),
migrations.AlterModelOptions(
name='record',
options={'ordering': ('domain', 'name'), 'verbose_name': 'record', 'verbose_name_plural': 'records'},
),
migrations.AlterModelOptions(
name='switchport',
options={'ordering': ('id',), 'verbose_name': 'switch port', 'verbose_name_plural': 'switch ports'},
),
migrations.AlterModelOptions(
name='vlan',
options={'ordering': ('vid',), 'verbose_name': 'vlan', 'verbose_name_plural': 'vlans'},
),
migrations.AlterModelOptions(
name='vlangroup',
options={'ordering': ('id',), 'verbose_name': 'vlan group', 'verbose_name_plural': 'vlan groups'},
),
]
...@@ -391,6 +391,11 @@ class Vlan(AclBase, models.Model): ...@@ -391,6 +391,11 @@ class Vlan(AclBase, models.Model):
modified_at = models.DateTimeField(auto_now=True, modified_at = models.DateTimeField(auto_now=True,
verbose_name=_('modified at')) verbose_name=_('modified at'))
class Meta:
verbose_name = _("vlan")
verbose_name_plural = _("vlans")
ordering = ('vid', )
def clean(self): def clean(self):
super(Vlan, self).clean() super(Vlan, self).clean()
if self.ipv6_template: if self.ipv6_template:
...@@ -540,6 +545,11 @@ class VlanGroup(models.Model): ...@@ -540,6 +545,11 @@ class VlanGroup(models.Model):
modified_at = models.DateTimeField(auto_now=True, modified_at = models.DateTimeField(auto_now=True,
verbose_name=_('modified at')) verbose_name=_('modified at'))
class Meta:
verbose_name = _("vlan group")
verbose_name_plural = _("vlan groups")
ordering = ('id', )
def __unicode__(self): def __unicode__(self):
return self.name return self.name
...@@ -562,6 +572,11 @@ class Group(models.Model): ...@@ -562,6 +572,11 @@ class Group(models.Model):
modified_at = models.DateTimeField(auto_now=True, modified_at = models.DateTimeField(auto_now=True,
verbose_name=_('modified at')) verbose_name=_('modified at'))
class Meta:
verbose_name = _("host group")
verbose_name_plural = _("host groups")
ordering = ('id', )
def __unicode__(self): def __unicode__(self):
return self.name return self.name
...@@ -935,6 +950,11 @@ class Firewall(models.Model): ...@@ -935,6 +950,11 @@ class Firewall(models.Model):
name = models.CharField(max_length=20, unique=True, name = models.CharField(max_length=20, unique=True,
verbose_name=_('name')) verbose_name=_('name'))
class Meta:
verbose_name = _("firewall")
verbose_name_plural = _("firewalls")
ordering = ('id', )
def __unicode__(self): def __unicode__(self):
return self.name return self.name
...@@ -981,6 +1001,11 @@ class Domain(models.Model): ...@@ -981,6 +1001,11 @@ class Domain(models.Model):
ttl = models.IntegerField(default=600, verbose_name=_('ttl')) ttl = models.IntegerField(default=600, verbose_name=_('ttl'))
description = models.TextField(blank=True, verbose_name=_('description')) description = models.TextField(blank=True, verbose_name=_('description'))
class Meta:
verbose_name = _("domain")
verbose_name_plural = _("domains")
ordering = ('id', )
def __unicode__(self): def __unicode__(self):
return self.name return self.name
...@@ -1058,6 +1083,8 @@ class Record(models.Model): ...@@ -1058,6 +1083,8 @@ class Record(models.Model):
return reverse('network.record', kwargs={'pk': self.pk}) return reverse('network.record', kwargs={'pk': self.pk})
class Meta: class Meta:
verbose_name = _("record")
verbose_name_plural = _("records")
ordering = ( ordering = (
'domain', 'domain',
'name', 'name',
...@@ -1077,6 +1104,11 @@ class SwitchPort(models.Model): ...@@ -1077,6 +1104,11 @@ class SwitchPort(models.Model):
modified_at = models.DateTimeField(auto_now=True, modified_at = models.DateTimeField(auto_now=True,
verbose_name=_('modified_at')) verbose_name=_('modified_at'))
class Meta:
verbose_name = _("switch port")
verbose_name_plural = _("switch ports")
ordering = ('id', )
def __unicode__(self): def __unicode__(self):
devices = ','.join(self.ethernet_devices.values_list('name', devices = ','.join(self.ethernet_devices.values_list('name',
flat=True)) flat=True))
...@@ -1104,6 +1136,11 @@ class EthernetDevice(models.Model): ...@@ -1104,6 +1136,11 @@ class EthernetDevice(models.Model):
modified_at = models.DateTimeField(auto_now=True, modified_at = models.DateTimeField(auto_now=True,
verbose_name=_('modified_at')) verbose_name=_('modified_at'))
class Meta:
verbose_name = _("ethernet device")
verbose_name_plural = _("ethernet devices")
ordering = ('id', )
def __unicode__(self): def __unicode__(self):
return self.name return self.name
...@@ -1136,7 +1173,8 @@ class BlacklistItem(models.Model): ...@@ -1136,7 +1173,8 @@ class BlacklistItem(models.Model):
class Meta(object): class Meta(object):
verbose_name = _('blacklist item') verbose_name = _('blacklist item')
verbose_name_plural = _('blacklist') verbose_name_plural = _('blacklist items')
ordering = ('id', )
def get_absolute_url(self): def get_absolute_url(self):
return reverse('network.blacklist', kwargs={'pk': self.pk}) return reverse('network.blacklist', kwargs={'pk': self.pk})
......
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