diff options
author | luxagraf <sng@luxagraf.net> | 2020-08-15 11:58:34 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-08-15 11:58:34 -0400 |
commit | b66d000ee469539ce7aea557b612c0444177e36d (patch) | |
tree | 273547921dc6f9ded2a5681b82514c68e28ba448 /app/projects/models/self_experiments.py | |
parent | d3e57c1bd17ad3e71810235a672d4782136901a5 (diff) |
archived old unused apps and migrated fieldnotes to posts
Diffstat (limited to 'app/projects/models/self_experiments.py')
-rw-r--r-- | app/projects/models/self_experiments.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/app/projects/models/self_experiments.py b/app/projects/models/self_experiments.py deleted file mode 100644 index be9d0b7..0000000 --- a/app/projects/models/self_experiments.py +++ /dev/null @@ -1,56 +0,0 @@ -import datetime -from django.db import models - -import markdown - -PUB_STATUS = ( - (0, 'Draft'), - (1, 'Published'), -) - - -def markdown_processor(md): - return markdown.markdown(md, ['footnotes'], safe_mode=False) - - -class Experiment(models.Model): - title = models.CharField(max_length=254) - slug = models.SlugField() - date_created = models.DateField(auto_now_add=True) - date_start = models.DateField() - date_end_actual = models.DateField(blank=True, null=True) - date_end_projected = models.DateField(blank=True) - duration = models.PositiveSmallIntegerField(default=30) - status = models.IntegerField(choices=PUB_STATUS, default=0) - body_html = models.TextField(blank=True) - body_markdown = models.TextField() - - class Meta: - app_label = 'projects' - ordering = ('-date_start',) - - # Returns the string representation of the model. - def __str__(self): - return self.title - - def get_absolute_url(self): - return "/projects/experiments/%s/%s/" % (self.pub_date.strftime("%Y").lower(), self.slug) - - def days_remaining(self): - return self.date_end_projected - datetime.date.today() - - @property - def get_previous_published(self): - return self.get_previous_by_pub_date(status__exact=1) - - @property - def get_next_published(self): - return self.get_next_by_pub_date(status__exact=1) - - def comment_period_open(self): - return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date - - def save(self): - self.body_html = markdown_processor(self.body_markdown) - self.date_end_projected = self.date_start + datetime.timedelta(self.duration) - super(Experiment, self).save() |