Commit db62a200 authored by Ali's avatar Ali

Adding URL's, bodies, and subjects to alerts

parent 1a8dda9c
Pipeline #3081 passed with stage
in 1 minute and 53 seconds
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:
......
......@@ -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
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 to comment