2015-06-18 09:19:53 -05:00
|
|
|
"""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()
|
|
|
|
|
2017-02-22 20:32:05 -06:00
|
|
|
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='')
|
|
|
|
|
2017-02-23 19:10:24 -06:00
|
|
|
recurring_period = models.CharField(max_length=64, default='')
|
2017-02-23 19:35:47 -06:00
|
|
|
recurring_until = models.DateTimeField(null=True, blank=True, default=None)
|
2017-02-23 19:10:24 -06:00
|
|
|
|
2015-06-18 09:19:53 -05:00
|
|
|
created_time = models.DateTimeField(auto_now_add=True)
|
|
|
|
|
2016-01-16 18:21:46 -06:00
|
|
|
def __str__(self):
|
2015-06-18 09:19:53 -05:00
|
|
|
"""String representation."""
|
|
|
|
return "{0:s} @ {1:s}".format(self.name, timezone.localtime(self.at_time).strftime('%Y-%m-%d %H:%M:%S %Z'))
|