Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2d70750e
authored
Jul 25, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: add get_absolute_url functions to models
parent
059334a1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
firewall/models.py
+32
-0
No files found.
firewall/models.py
View file @
2d70750e
...
@@ -128,6 +128,10 @@ class Rule(models.Model):
...
@@ -128,6 +128,10 @@ class Rule(models.Model):
((
"dport=
%
s "
%
self
.
dport
)
if
self
.
dport
else
''
)),
((
"dport=
%
s "
%
self
.
dport
)
if
self
.
dport
else
''
)),
'desc'
:
self
.
description
}
'desc'
:
self
.
description
}
@models.permalink
def
get_absolute_url
(
self
):
return
(
'network.rule'
,
None
,
{
'pk'
:
self
.
pk
})
class
Meta
:
class
Meta
:
verbose_name
=
_
(
"rule"
)
verbose_name
=
_
(
"rule"
)
verbose_name_plural
=
_
(
"rules"
)
verbose_name_plural
=
_
(
"rules"
)
...
@@ -261,6 +265,10 @@ class Vlan(models.Model):
...
@@ -261,6 +265,10 @@ class Vlan(models.Model):
"""String representation of selected IPv4 network."""
"""String representation of selected IPv4 network."""
return
self
.
net4
+
"/"
+
unicode
(
self
.
prefix4
)
return
self
.
net4
+
"/"
+
unicode
(
self
.
prefix4
)
@models.permalink
def
get_absolute_url
(
self
):
return
(
'network.vlan'
,
None
,
{
'vid'
:
self
.
vid
})
class
VlanGroup
(
models
.
Model
):
class
VlanGroup
(
models
.
Model
):
"""
"""
...
@@ -285,6 +293,10 @@ class VlanGroup(models.Model):
...
@@ -285,6 +293,10 @@ class VlanGroup(models.Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
@models.permalink
def
get_absolute_url
(
self
):
return
(
'network.vlangroup'
,
None
,
{
'pk'
:
self
.
pk
})
class
Group
(
models
.
Model
):
class
Group
(
models
.
Model
):
"""
"""
...
@@ -304,6 +316,10 @@ class Group(models.Model):
...
@@ -304,6 +316,10 @@ class Group(models.Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
@models.permalink
def
get_absolute_url
(
self
):
return
(
'network.group'
,
None
,
{
'pk'
:
self
.
pk
})
class
Host
(
models
.
Model
):
class
Host
(
models
.
Model
):
"""
"""
...
@@ -549,6 +565,10 @@ class Host(models.Model):
...
@@ -549,6 +565,10 @@ class Host(models.Model):
"""
"""
return
self
.
hostname
+
u'.'
+
unicode
(
self
.
vlan
.
domain
)
return
self
.
hostname
+
u'.'
+
unicode
(
self
.
vlan
.
domain
)
@models.permalink
def
get_absolute_url
(
self
):
return
(
'network.host'
,
None
,
{
'pk'
:
self
.
pk
})
class
Firewall
(
models
.
Model
):
class
Firewall
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
)
name
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
)
...
@@ -568,6 +588,10 @@ class Domain(models.Model):
...
@@ -568,6 +588,10 @@ class Domain(models.Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
@models.permalink
def
get_absolute_url
(
self
):
return
(
'network.domain'
,
None
,
{
'pk'
:
self
.
pk
})
class
Record
(
models
.
Model
):
class
Record
(
models
.
Model
):
CHOICES_type
=
((
'A'
,
'A'
),
(
'CNAME'
,
'CNAME'
),
(
'AAAA'
,
'AAAA'
),
CHOICES_type
=
((
'A'
,
'A'
),
(
'CNAME'
,
'CNAME'
),
(
'AAAA'
,
'AAAA'
),
...
@@ -683,6 +707,10 @@ class Record(models.Model):
...
@@ -683,6 +707,10 @@ class Record(models.Model):
'ttl'
:
self
.
ttl
,
'ttl'
:
self
.
ttl
,
'address'
:
address
}
'address'
:
address
}
@models.permalink
def
get_absolute_url
(
self
):
return
(
'network.record'
,
None
,
{
'pk'
:
self
.
pk
})
class
Blacklist
(
models
.
Model
):
class
Blacklist
(
models
.
Model
):
CHOICES_type
=
((
'permban'
,
'permanent ban'
),
(
'tempban'
,
'temporary ban'
),
CHOICES_type
=
((
'permban'
,
'permanent ban'
),
(
'tempban'
,
'temporary ban'
),
...
@@ -705,6 +733,10 @@ class Blacklist(models.Model):
...
@@ -705,6 +733,10 @@ class Blacklist(models.Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
ipv4
return
self
.
ipv4
@models.permalink
def
get_absolute_url
(
self
):
return
(
'network.blacklist'
,
None
,
{
'pk'
:
self
.
pk
})
def
send_task
(
sender
,
instance
,
created
,
**
kwargs
):
def
send_task
(
sender
,
instance
,
created
,
**
kwargs
):
from
firewall.tasks
import
ReloadTask
from
firewall.tasks
import
ReloadTask
...
...
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