summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-08-03 18:39:37 -0400
committerluxagraf <sng@luxagraf.net>2020-08-03 18:39:37 -0400
commit55409474092d594f3c483e0869b71f962c706322 (patch)
tree191608fdcf157e1be1477f4a6ad95e4af78c4f77 /app
parenteea8117ac3b58d8ac9eb1c9f94d27ac28fc67008 (diff)
added the rest of my recent work
Diffstat (limited to 'app')
-rw-r--r--app/garden/models.py3
-rw-r--r--app/normalize/migrations/0003_auto_20200418_0909.py17
-rw-r--r--app/prompts/models.py35
-rw-r--r--app/utils/views.py7
4 files changed, 59 insertions, 3 deletions
diff --git a/app/garden/models.py b/app/garden/models.py
index 5af306a..56e8c30 100644
--- a/app/garden/models.py
+++ b/app/garden/models.py
@@ -24,6 +24,9 @@ PLANT_FAMILY = (
class Plant(models.Model):
+ """
+ Model to hold Plant Definitions
+ """
name = models.CharField(max_length=200)
family = models.IntegerField(choices=PLANT_FAMILY, default=0)
scientific_name = models.CharField(max_length=200, null=True, blank=True)
diff --git a/app/normalize/migrations/0003_auto_20200418_0909.py b/app/normalize/migrations/0003_auto_20200418_0909.py
new file mode 100644
index 0000000..a4b887c
--- /dev/null
+++ b/app/normalize/migrations/0003_auto_20200418_0909.py
@@ -0,0 +1,17 @@
+# Generated by Django 2.1.2 on 2020-04-18 09:09
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('normalize', '0002_auto_20191207_0922'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='relatedpost',
+ options={'get_latest_by': 'pub_date', 'ordering': ('-model_name', '-pub_date')},
+ ),
+ ]
diff --git a/app/prompts/models.py b/app/prompts/models.py
index 00ce3ce..7b5dc71 100644
--- a/app/prompts/models.py
+++ b/app/prompts/models.py
@@ -6,6 +6,23 @@ 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)
@@ -57,3 +74,21 @@ class Prompt(models.Model):
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/utils/views.py b/app/utils/views.py
index 152b2b7..d4c9eae 100644
--- a/app/utils/views.py
+++ b/app/utils/views.py
@@ -15,7 +15,8 @@ from recordings.models import Audio
BREADCRUMBS = {
'SrcPost':'SRC',
'Book':'Book Notes',
- 'Entry':'Jrnl'
+ 'Entry':'Jrnl',
+ 'NewsletterMailing':'lttr'
}
class PaginatedListView(ListView):
@@ -31,7 +32,6 @@ class PaginatedListView(ListView):
request.page_url = "/" + path + '/%d/'
else:
request.page_url = request.path + '%d/'
- print(request.page_url)
request.page = int(self.kwargs['page'])
request.base_path = path
return super(PaginatedListView, self).dispatch(request, *args, **kwargs)
@@ -42,6 +42,7 @@ class PaginatedListView(ListView):
'''
# Call the base implementation first to get a context
context = super(PaginatedListView, self).get_context_data(**kwargs)
+ print('model=', self.model)
try:
context['breadcrumbs'] = (BREADCRUMBS[self.model.__name__],)
except KeyError:
@@ -72,7 +73,7 @@ class LuxDetailView(DetailView):
context['crumb_url']
except KeyError:
try:
- context['crumb_url'] = reverse('%s:list' % self.object._meta.verbose_name_plural)
+ context['crumb_url'] = reverse('%s:list' % self.object._meta.verbose_name_plural.slugify())
except:
# special case for pages:
context['breadcrumbs'] = (self.object.title,)