Skip to content
Snippets Groups Projects
Commit 2e397aca authored by Vaibhav Mule's avatar Vaibhav Mule Committed by Fredrik Jonsson
Browse files

refactor review message

parent 9f478f28
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ from django.http import HttpRequest ...@@ -5,7 +5,7 @@ from django.http import HttpRequest
from django.urls import set_urlconf from django.urls import set_urlconf
from django.utils import timezone from django.utils import timezone
from hypha.apply.activity.messaging import MESSAGES, messenger from hypha.apply.activity.messaging import messenger
from hypha.apply.funds.models import Reminder from hypha.apply.funds.models import Reminder
from hypha.apply.home.models import ApplyHomePage from hypha.apply.home.models import ApplyHomePage
...@@ -28,7 +28,7 @@ class Command(BaseCommand): ...@@ -28,7 +28,7 @@ class Command(BaseCommand):
for reminder in Reminder.objects.filter(sent=False, time__lte=timezone.now()): for reminder in Reminder.objects.filter(sent=False, time__lte=timezone.now()):
messenger( messenger(
MESSAGES.REVIEW_REMINDER, reminder.action_message,
request=request, request=request,
user=None, user=None,
source=reminder.submission, source=reminder.submission,
......
...@@ -2,6 +2,8 @@ from django.conf import settings ...@@ -2,6 +2,8 @@ from django.conf import settings
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from hypha.apply.activity.messaging import MESSAGES
class Reminder(models.Model): class Reminder(models.Model):
REVIEW = 'review' REVIEW = 'review'
...@@ -14,6 +16,9 @@ class Reminder(models.Model): ...@@ -14,6 +16,9 @@ class Reminder(models.Model):
SLACK: 'Slack', SLACK: 'Slack',
EMAIL: 'Email', EMAIL: 'Email',
} }
ACTIONS = {
REVIEW: MESSAGES.REVIEW_REMINDER
}
submission = models.ForeignKey( submission = models.ForeignKey(
'funds.ApplicationSubmission', 'funds.ApplicationSubmission',
on_delete=models.CASCADE, on_delete=models.CASCADE,
...@@ -49,3 +54,7 @@ class Reminder(models.Model): ...@@ -49,3 +54,7 @@ class Reminder(models.Model):
@property @property
def time_with_format(self): def time_with_format(self):
return self.time.strftime('%Y-%m-%d %I:%M %p') return self.time.strftime('%Y-%m-%d %I:%M %p')
@property
def action_message(self):
return self.ACTIONS[self.action]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment