dr.botzo/countdown/models.py
Brian S. Stephan c81d0519a0 countdown: fields for sending reminders
extending countdown items in order to have them also store reminders,
which are the same idea (an event at a time) but these are watched by
the irc bot and sent to the specified destination when the time is
reached

this adds support for configuring this, code in support of it is coming
in later commits

bss/dr.botzo#11
2017-02-22 20:32:05 -06:00

31 lines
784 B
Python

"""Countdown item models."""
import logging
from django.db import models
from django.utils import timezone
log = logging.getLogger('countdown.models')
class CountdownItem(models.Model):
"""Track points in time."""
name = models.CharField(max_length=64, default='')
at_time = models.DateTimeField()
is_reminder = models.BooleanField(default=False)
sent_reminder = models.BooleanField(default=False)
reminder_message = models.TextField(default="")
reminder_target = models.CharField(max_length=64, default='')
created_time = models.DateTimeField(auto_now_add=True)
def __str__(self):
"""String representation."""
return "{0:s} @ {1:s}".format(self.name, timezone.localtime(self.at_time).strftime('%Y-%m-%d %H:%M:%S %Z'))