summaryrefslogtreecommitdiff
path: root/app/unused_apps/prompts
diff options
context:
space:
mode:
Diffstat (limited to 'app/unused_apps/prompts')
-rw-r--r--app/unused_apps/prompts/__init__.py0
-rw-r--r--app/unused_apps/prompts/admin.py30
-rw-r--r--app/unused_apps/prompts/migrations/0001_initial.py32
-rw-r--r--app/unused_apps/prompts/migrations/0002_auto_20190228_0941.py34
-rw-r--r--app/unused_apps/prompts/migrations/0003_prompt_prompt_type.py18
-rw-r--r--app/unused_apps/prompts/migrations/__init__.py0
-rw-r--r--app/unused_apps/prompts/models.py94
-rw-r--r--app/unused_apps/prompts/urls.py13
-rw-r--r--app/unused_apps/prompts/views.py11
9 files changed, 0 insertions, 232 deletions
diff --git a/app/unused_apps/prompts/__init__.py b/app/unused_apps/prompts/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/app/unused_apps/prompts/__init__.py
+++ /dev/null
diff --git a/app/unused_apps/prompts/admin.py b/app/unused_apps/prompts/admin.py
deleted file mode 100644
index f12c904..0000000
--- a/app/unused_apps/prompts/admin.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from django.contrib import admin
-
-from utils.widgets import LGEntryForm
-from .models import Prompt
-
-
-@admin.register(Prompt)
-class PromptAdmin(admin.ModelAdmin):
- form = LGEntryForm
- prepopulated_fields = {"slug": ('title',)}
- list_display = ('title', 'source', 'prompt_type')
- list_filter = ('source', 'prompt_type')
- fieldsets = (
- ('Prompt', {
- 'fields': (
- 'title',
- 'subtitle',
- 'body_markdown',
- ('pub_date', 'prompt_type'),
- ('slug','source'),
- 'meta_description'
- ),
- 'classes': (
- 'show',
- 'extrapretty',
- 'wide'
- )
- }
- ),
- )
diff --git a/app/unused_apps/prompts/migrations/0001_initial.py b/app/unused_apps/prompts/migrations/0001_initial.py
deleted file mode 100644
index c5a24ec..0000000
--- a/app/unused_apps/prompts/migrations/0001_initial.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Generated by Django 2.1.5 on 2019-02-20 22:52
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ]
-
- operations = [
- migrations.CreateModel(
- name='Prompt',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('title', models.CharField(max_length=200)),
- ('subtitle', models.CharField(max_length=200)),
- ('slug', models.SlugField(unique_for_date='pub_date')),
- ('body_html', models.TextField(blank=True)),
- ('body_markdown', models.TextField()),
- ('pub_date', models.DateTimeField(verbose_name='Date published')),
- ('meta_description', models.CharField(blank=True, max_length=256, null=True)),
- ('source', models.CharField(max_length=350)),
- ],
- options={
- 'ordering': ('-pub_date',),
- 'get_latest_by': 'pub_date',
- },
- ),
- ]
diff --git a/app/unused_apps/prompts/migrations/0002_auto_20190228_0941.py b/app/unused_apps/prompts/migrations/0002_auto_20190228_0941.py
deleted file mode 100644
index 5b66a99..0000000
--- a/app/unused_apps/prompts/migrations/0002_auto_20190228_0941.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Generated by Django 2.1.7 on 2019-02-28 09:41
-
-import datetime
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('prompts', '0001_initial'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='prompt',
- name='pub_date',
- field=models.DateTimeField(default=datetime.datetime.now),
- ),
- migrations.AlterField(
- model_name='prompt',
- name='slug',
- field=models.SlugField(blank=True, unique_for_date='pub_date'),
- ),
- migrations.AlterField(
- model_name='prompt',
- name='source',
- field=models.CharField(blank=True, max_length=350),
- ),
- migrations.AlterField(
- model_name='prompt',
- name='subtitle',
- field=models.CharField(blank=True, max_length=200),
- ),
- ]
diff --git a/app/unused_apps/prompts/migrations/0003_prompt_prompt_type.py b/app/unused_apps/prompts/migrations/0003_prompt_prompt_type.py
deleted file mode 100644
index d027c6e..0000000
--- a/app/unused_apps/prompts/migrations/0003_prompt_prompt_type.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 2.1.2 on 2020-07-05 22:04
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('prompts', '0002_auto_20190228_0941'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='prompt',
- name='prompt_type',
- field=models.IntegerField(choices=[(0, 'Meditation'), (1, 'Writing'), (2, 'Kids Writing')], default=0),
- ),
- ]
diff --git a/app/unused_apps/prompts/migrations/__init__.py b/app/unused_apps/prompts/migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/app/unused_apps/prompts/migrations/__init__.py
+++ /dev/null
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
diff --git a/app/unused_apps/prompts/urls.py b/app/unused_apps/prompts/urls.py
deleted file mode 100644
index 7cbe09a..0000000
--- a/app/unused_apps/prompts/urls.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from django.urls import path
-
-from . import views
-
-app_name = "prompts"
-
-urlpatterns = [
- path(
- r'',
- views.RandomList.as_view(),
- name="random-prompt"
- ),
-]
diff --git a/app/unused_apps/prompts/views.py b/app/unused_apps/prompts/views.py
deleted file mode 100644
index 4744299..0000000
--- a/app/unused_apps/prompts/views.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from django.views.generic.detail import DetailView
-
-from .models import Prompt
-
-
-class PromptList(DetailView):
- model = Prompt
-
- def get_object(self, queryset):
- """ This might be faster: random.choice(Prompt.objects.all())"""
- return Prompt.objects.order_by('?').first()