Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FoD
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Schmitz
FoD
Commits
ce47f00e
Commit
ce47f00e
authored
5 years ago
by
Tomáš Čejka
Browse files
Options
Downloads
Patches
Plain Diff
String representation of Django model objects
parent
52d2311a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flowspec/models.py
+15
-0
15 additions, 0 deletions
flowspec/models.py
peers/models.py
+6
-0
6 additions, 0 deletions
peers/models.py
with
21 additions
and
0 deletions
flowspec/models.py
+
15
−
0
View file @
ce47f00e
...
@@ -97,6 +97,8 @@ class MatchPort(models.Model):
...
@@ -97,6 +97,8 @@ class MatchPort(models.Model):
port
=
models
.
CharField
(
max_length
=
24
,
unique
=
True
)
port
=
models
.
CharField
(
max_length
=
24
,
unique
=
True
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
port
return
self
.
port
def
__str__
(
self
):
return
self
.
__unicode__
()
class
Meta
:
class
Meta
:
db_table
=
u
'
match_port
'
db_table
=
u
'
match_port
'
...
@@ -104,6 +106,8 @@ class MatchDscp(models.Model):
...
@@ -104,6 +106,8 @@ class MatchDscp(models.Model):
dscp
=
models
.
CharField
(
max_length
=
24
)
dscp
=
models
.
CharField
(
max_length
=
24
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
dscp
return
self
.
dscp
def
__str__
(
self
):
return
self
.
__unicode__
()
class
Meta
:
class
Meta
:
db_table
=
u
'
match_dscp
'
db_table
=
u
'
match_dscp
'
...
@@ -111,6 +115,8 @@ class MatchProtocol(models.Model):
...
@@ -111,6 +115,8 @@ class MatchProtocol(models.Model):
protocol
=
models
.
CharField
(
max_length
=
24
,
unique
=
True
)
protocol
=
models
.
CharField
(
max_length
=
24
,
unique
=
True
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
protocol
return
self
.
protocol
def
__str__
(
self
):
return
self
.
__unicode__
()
class
Meta
:
class
Meta
:
db_table
=
u
'
match_protocol
'
db_table
=
u
'
match_protocol
'
...
@@ -120,6 +126,9 @@ class FragmentType(models.Model):
...
@@ -120,6 +126,9 @@ class FragmentType(models.Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
"
%s
"
%
(
self
.
fragmenttype
)
return
"
%s
"
%
(
self
.
fragmenttype
)
def
__str__
(
self
):
return
self
.
__unicode__
()
class
ThenAction
(
models
.
Model
):
class
ThenAction
(
models
.
Model
):
action
=
models
.
CharField
(
max_length
=
60
,
choices
=
THEN_CHOICES
,
verbose_name
=
"
Action
"
)
action
=
models
.
CharField
(
max_length
=
60
,
choices
=
THEN_CHOICES
,
verbose_name
=
"
Action
"
)
...
@@ -129,6 +138,9 @@ class ThenAction(models.Model):
...
@@ -129,6 +138,9 @@ class ThenAction(models.Model):
ret
=
"
%s:%s
"
%
(
self
.
action
,
self
.
action_value
)
ret
=
"
%s:%s
"
%
(
self
.
action
,
self
.
action_value
)
return
ret
.
rstrip
(
"
:
"
)
return
ret
.
rstrip
(
"
:
"
)
def
__str__
(
self
):
return
self
.
__unicode__
()
class
Meta
:
class
Meta
:
db_table
=
u
'
then_action
'
db_table
=
u
'
then_action
'
ordering
=
[
'
action
'
,
'
action_value
'
]
ordering
=
[
'
action
'
,
'
action_value
'
]
...
@@ -187,6 +199,9 @@ class Route(models.Model):
...
@@ -187,6 +199,9 @@ class Route(models.Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
def
__str__
(
self
):
return
self
.
__unicode__
()
class
Meta
:
class
Meta
:
db_table
=
u
'
route
'
db_table
=
u
'
route
'
verbose_name
=
"
Rule
"
verbose_name
=
"
Rule
"
...
...
This diff is collapsed.
Click to expand it.
peers/models.py
+
6
−
0
View file @
ce47f00e
...
@@ -28,6 +28,8 @@ class PeerRange(models.Model):
...
@@ -28,6 +28,8 @@ class PeerRange(models.Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
network
return
self
.
network
def
__str__
(
self
):
return
self
.
__unicode__
()
class
Meta
:
class
Meta
:
db_table
=
u
'
peer_range
'
db_table
=
u
'
peer_range
'
...
@@ -40,6 +42,8 @@ class TechcEmail(models.Model):
...
@@ -40,6 +42,8 @@ class TechcEmail(models.Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
email
return
self
.
email
def
__str__
(
self
):
return
self
.
__unicode__
()
class
Meta
:
class
Meta
:
db_table
=
"
techc_email
"
db_table
=
"
techc_email
"
...
@@ -58,6 +62,8 @@ class Peer(models.Model):
...
@@ -58,6 +62,8 @@ class Peer(models.Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
peer_name
return
self
.
peer_name
def
__str__
(
self
):
return
self
.
__unicode__
()
class
Meta
:
class
Meta
:
db_table
=
u
'
peer
'
db_table
=
u
'
peer
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment