summaryrefslogtreecommitdiff
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
parenteea8117ac3b58d8ac9eb1c9f94d27ac28fc67008 (diff)
added the rest of my recent work
-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
-rw-r--r--design/sass/_lttr.scss62
-rw-r--r--design/templates/lib/img_product.html10
6 files changed, 131 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,)
diff --git a/design/sass/_lttr.scss b/design/sass/_lttr.scss
new file mode 100644
index 0000000..4ce9f13
--- /dev/null
+++ b/design/sass/_lttr.scss
@@ -0,0 +1,62 @@
+.large-top-image{
+ background: #faf7f5;
+ img {
+ max-width: 94%;
+ margin: 4rem 0;
+ }
+}
+.lttr {
+ @include constrain_narrow;
+ margin-top: 6rem;
+ header {
+ padding-bottom: 3rem;
+ border-bottom: 1px #f0edeb solid
+ }
+}
+.lttr-box {
+ background: #faf7f5;
+ padding: .5rem;
+ display: inline-block;
+ border: 1px #e0dedc solid;
+}
+.lttr-cover {
+ margin-right: 1.2rem;
+}
+#recommended-reading {
+ .book-title {
+ @include fontsize(28);
+ font-weight: 400;
+ margin-bottom: 0;
+ }
+ h6 {
+ margin-top: 0;
+ @include fontsize(18);
+ font-weight: 400;
+ }
+}
+
+#page-navigation img {
+ width: 300px;
+ height: 160px;
+ object-fit: cover;
+}
+#page-navigation h4 {
+ text-align: center;
+ @include fontsize(22);
+ @include fancy_sans;
+ color: #333;
+}
+#page-navigation .nav-title {
+ @include fontsize(22);
+ line-height: 1.5;
+}
+#page-navigation .photo-arrow-next {
+ text-align: left;
+}
+.page-nav-photo li {
+ display: inline-block;
+ margin: 0 0 0 3rem !important;
+ &:first-of-type {
+ margin-left: 0 !important;
+ }
+}
diff --git a/design/templates/lib/img_product.html b/design/templates/lib/img_product.html
new file mode 100644
index 0000000..4a8c36d
--- /dev/null
+++ b/design/templates/lib/img_product.html
@@ -0,0 +1,10 @@
+{% load get_image_by_size %}
+{% load get_image_width %}
+{% if caption or exif or image.photo_credit_source %}
+<figure{%if not is_cluster %} class="picfull"{%endif%}>{%else%}{%if not is_cluster %}<div class="picfull">{%endif%}{%endif%}
+ <a itemscope itemtype="http://schema.org/ImageObject" href="{%get_image_by_size image "original"%} " title="view larger image">
+ <img class="u-photo" itemprop="contentUrl" sizes="(max-width: 750px) 100vw, (min-width: 751) 750px" srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.name %} {{size.width}}w{% if forloop.last%}"{%else%}, {%endif%}{%endfor%}{% for size in image.sizes.all%}{%if not forloop.first and not forloop.last%} src="{% get_image_by_size image size.name%}"{%endif%}{%endfor%} alt="{{image.alt}} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}luxagraf{%endif%}" data-jslghtbx="{%get_image_by_size image "original"%}" data-jslghtbx-group="group" {% if caption%}data-jslghtbx-caption="{{image.caption}}"{%endif%}>
+ </a>
+{% if caption or exif or image.photo_credit_source %}<figcaption>{% endif %}{% if caption %}{{image.caption|safe}}{% endif %}{% if exif %} | <small>Camera: {{image.exif_make}} {{image.exif_model}} with {{image.exif_lens}}</small>{% endif %}{% if image.photo_credit_source %}{%if caption or exif %} | {%endif%}image by {% if image.photo_credit_url %}<a href="{{image.photo_credit_url}}" itemprop="author">{%endif%}{{image.photo_credit_source}}{% if image.photo_credit_url %}</a>{%endif%}{%endif%}{% if caption or exif or image.photo_credit_source %}</figcaption>
+</figure>{%else%}{%if not is_cluster %}</div>{%endif%}
+{% endif %}