Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open
Commits
db62a200
Commit
db62a200
authored
Oct 03, 2018
by
Ali
Browse files
Adding URL's, bodies, and subjects to alerts
parent
1a8dda9c
Pipeline
#3081
passed with stage
in 1 minute and 53 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
docker-compose.yml
View file @
db62a200
version
:
"
3"
services
:
db
:
image
:
mysql:5.7
...
...
@@ -10,7 +11,7 @@ services:
mysqld --character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
ports
:
-
"
3306
:3306"
-
3306
networks
:
-
wopen_net
environment
:
...
...
@@ -20,7 +21,7 @@ services:
MYSQL_PASSWORD
:
wopen
api
:
image
:
whats-open-api
build
:
.
deploy
:
replicas
:
1
restart_policy
:
...
...
whats-open/api/models.py
View file @
db62a200
...
...
@@ -408,15 +408,21 @@ class Alert(TimeStampedModel):
(
INFO
,
'Info'
),
(
MINOR
,
'Minor'
),
(
MAJOR
,
'Major'
),
(
EMERGENCY
,
'Emergency'
),
(
EMERGENCY
,
'Emergency'
),
)
# The urgency tag for this Alert
urgency_tag
=
models
.
CharField
(
max_length
=
10
,
default
=
'Info'
,
choices
=
URGENCY_CHOICES
)
# The text that is displayed that describes the Alert
message
=
models
.
CharField
(
max_length
=
140
)
subject
=
models
.
CharField
(
max_length
=
130
)
body
=
models
.
TextField
()
url
=
models
.
URLField
(
max_length
=
200
)
# The date + time that the alert will be start being served
start_datetime
=
models
.
DateTimeField
()
...
...
@@ -431,9 +437,11 @@ class Alert(TimeStampedModel):
# Get the current datetime
now
=
timezone
.
now
()
return
self
.
start_datetime
<
now
<
self
.
end_datetime
def
__str__
(
self
):
"""
String representation of an Alert object.
"""
return
"%s"
%
(
self
.
message
)
return
"{0}
\n
{1}
\n
{3}"
.
format
(
self
.
subject
,
self
.
body
,
self
.
url
)
# Returns the subject, body, and url fields
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