Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
0c795347
authored
Mar 19, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: set natural ordering for hosts
parent
19bd2854
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
0 deletions
+3
-0
circle/firewall/migrations/0044_auto__add_field_host_normalized_hostname.py
+0
-0
circle/firewall/models.py
+3
-0
No files found.
circle/firewall/migrations/0044_auto__add_field_host_normalized_hostname.py
0 → 100644
View file @
0c795347
This diff is collapsed.
Click to expand it.
circle/firewall/models.py
View file @
0c795347
...
@@ -17,6 +17,7 @@ import django.conf
...
@@ -17,6 +17,7 @@ import django.conf
from
django.db.models.signals
import
post_save
,
post_delete
from
django.db.models.signals
import
post_save
,
post_delete
import
random
import
random
from
common.models
import
HumanSortField
from
firewall.tasks.local_tasks
import
reloadtask
from
firewall.tasks.local_tasks
import
reloadtask
from
acl.models
import
AclBase
from
acl.models
import
AclBase
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -397,6 +398,7 @@ class Host(models.Model):
...
@@ -397,6 +398,7 @@ class Host(models.Model):
'the host, the first part of '
'the host, the first part of '
'the FQDN.'
),
'the FQDN.'
),
validators
=
[
val_alfanum
])
validators
=
[
val_alfanum
])
normalized_hostname
=
HumanSortField
(
monitor
=
'hostname'
,
max_length
=
80
)
reverse
=
models
.
CharField
(
max_length
=
40
,
validators
=
[
val_domain
],
reverse
=
models
.
CharField
(
max_length
=
40
,
validators
=
[
val_domain
],
verbose_name
=
_
(
'reverse'
),
verbose_name
=
_
(
'reverse'
),
help_text
=
_
(
'The fully qualified reverse '
help_text
=
_
(
'The fully qualified reverse '
...
@@ -450,6 +452,7 @@ class Host(models.Model):
...
@@ -450,6 +452,7 @@ class Host(models.Model):
class
Meta
(
object
):
class
Meta
(
object
):
unique_together
=
(
'hostname'
,
'vlan'
)
unique_together
=
(
'hostname'
,
'vlan'
)
ordering
=
(
'normalized_hostname'
,
'vlan'
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
hostname
return
self
.
hostname
...
...
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