diff options
author | luxagraf <sng@luxagraf.net> | 2020-12-02 15:02:12 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-12-02 15:02:12 -0500 |
commit | ab8055b5cab2523d925f59c65bc38df103a26991 (patch) | |
tree | 29e4597bc0d86d658f574c0c4f0b036351a68742 /app/unused_apps/prompts/models.py | |
parent | 87f692178a6e30719c564076f00c206642f36ce6 (diff) |
deleted old apps and media
Diffstat (limited to 'app/unused_apps/prompts/models.py')
-rw-r--r-- | app/unused_apps/prompts/models.py | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/app/unused_apps/prompts/models.py b/app/unused_apps/prompts/models.py deleted file mode 100644 index 7b5dc71..0000000 --- a/app/unused_apps/prompts/models.py +++ /dev/null @@ -1,94 +0,0 @@ -import datetime -from django.contrib.gis.db import models -from django.urls import reverse -from django.apps import apps - -from utils.util import render_images, markdown_to_html - - -class Source(models.Model): - name = models.CharField(max_length=200) - link = models.CharField(max_length=400) - SOURCE_TYPE = ( - (0, 'Book'), - (1, 'Website'), - (2, 'Other'), - ) - source_type = models.IntegerField(choices=SOURCE_TYPE, default=0) - - class Meta: - ordering = ('name',) - - def __str__(self): - return self.name - - -class Prompt(models.Model): - title = models.CharField(max_length=200) - subtitle = models.CharField(max_length=200, blank=True) - meta_description = models.CharField(max_length=256, null=True, blank=True) - slug = models.SlugField(unique_for_date='pub_date', blank=True) - body_markdown = models.TextField() - body_html = models.TextField(blank=True) - pub_date = models.DateTimeField(default=datetime.datetime.now) - source = models.CharField(max_length=350, blank=True) - PROMPT_TYPE = ( - (0, 'Meditation'), - (1, 'Writing'), - (2, 'Kids Writing'), - ) - prompt_type = models.IntegerField(choices=PROMPT_TYPE, default=0) - - class Meta: - ordering = ('-pub_date',) - get_latest_by = 'pub_date' - - def __str__(self): - return self.title - - def get_absolute_url(self): - return reverse("prompt:detail", kwargs={"slug": self.slug}) - - @property - def get_previous_published(self): - return self.get_previous_by_pub_date(status__exact=1) - - @property - def get_previous_admin_url(self): - n = self.get_previous_by_pub_date() - return reverse('admin:%s_%s_change' % (self._meta.app_label, self._meta.model_name), args=[n.id]) - - @property - def get_next_published(self): - return self.get_next_by_pub_date(status__exact=1) - - @property - def get_next_admin_url(self): - model = apps.get_model(app_label=self._meta.app_label, model_name=self._meta.model_name) - try: - return reverse('admin:%s_%s_change' % (self._meta.app_label, self._meta.model_name), args=[self.get_next_by_pub_date().pk]) - except model.DoesNotExist: - return '' - - def save(self, *args, **kwargs): - md = render_images(self.body_markdown) - self.body_html = markdown_to_html(md) - super(Prompt, self).save(*args, **kwargs) - - - -class Source(models.Model): - name = models.CharField(max_length=200) - link = models.CharField(max_length=400) - SOURCE_TYPE = ( - (0, 'Book'), - (1, 'Website'), - (2, 'Other'), - ) - source_type = models.IntegerField(choices=SOURCE_TYPE, default=0) - - class Meta: - ordering = ('name',) - - def __str__(self): - return self.name |