From 4fec1159612fad17a7385ba8aadc4a4b165d5aa9 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Mon, 7 Oct 2019 15:27:00 -0400 Subject: added new posts stuff and changed name of src posts --- app/essays/__init__.py | 0 app/essays/admin.py | 47 ------ app/essays/build.py | 22 --- app/essays/migrations/0001_initial.py | 49 ------ app/essays/migrations/0002_auto_20190204_1541.py | 23 --- app/essays/migrations/0003_essay_afterword_html.py | 18 -- app/essays/migrations/0004_auto_20190205_0830.py | 27 --- app/essays/migrations/0005_auto_20190208_0946.py | 25 --- app/essays/migrations/0006_auto_20190303_1625.py | 18 -- .../migrations/0006_remove_essay_has_video.py | 17 -- app/essays/migrations/0007_auto_20190414_1455.py | 18 -- app/essays/migrations/0007_essay_has_video.py | 18 -- app/essays/migrations/0008_merge_20190303_1638.py | 14 -- app/essays/migrations/0009_merge_20190414_1500.py | 14 -- app/essays/migrations/0010_essay_field_notes.py | 19 --- app/essays/migrations/__init__.py | 0 app/essays/models.py | 91 ----------- app/essays/urls.py | 28 ---- app/essays/views.py | 47 ------ app/links/admin.py | 3 +- app/posts/admin.py | 8 +- app/posts/migrations/0006_post_short_title.py | 19 +++ app/posts/migrations/0007_auto_20191007_0949.py | 21 +++ app/posts/migrations/0008_post_topics.py | 19 +++ app/posts/models.py | 16 +- app/posts/templates/posts/guide_detail.html | 182 +++++++++++++++++++++ app/posts/templates/posts/post_list.html | 14 +- app/posts/views.py | 8 + app/src/admin.py | 4 +- app/src/migrations/0004_auto_20191007_0905.py | 17 ++ app/src/models.py | 2 +- app/src/views.py | 10 +- app/taxonomy/migrations/0002_auto_20191007_0913.py | 17 ++ app/taxonomy/models.py | 4 +- app/taxonomy/urls.py | 13 ++ app/taxonomy/views.py | 14 ++ app/unused_apps/essays/__init__.py | 0 app/unused_apps/essays/admin.py | 47 ++++++ app/unused_apps/essays/build.py | 22 +++ app/unused_apps/essays/migrations/0001_initial.py | 49 ++++++ .../essays/migrations/0002_auto_20190204_1541.py | 23 +++ .../essays/migrations/0003_essay_afterword_html.py | 18 ++ .../essays/migrations/0004_auto_20190205_0830.py | 27 +++ .../essays/migrations/0005_auto_20190208_0946.py | 25 +++ .../essays/migrations/0006_auto_20190303_1625.py | 18 ++ .../migrations/0006_remove_essay_has_video.py | 17 ++ .../essays/migrations/0007_auto_20190414_1455.py | 18 ++ .../essays/migrations/0007_essay_has_video.py | 18 ++ .../essays/migrations/0008_merge_20190303_1638.py | 14 ++ .../essays/migrations/0009_merge_20190414_1500.py | 14 ++ .../essays/migrations/0010_essay_field_notes.py | 19 +++ app/unused_apps/essays/migrations/__init__.py | 0 app/unused_apps/essays/models.py | 91 +++++++++++ app/unused_apps/essays/urls.py | 28 ++++ app/unused_apps/essays/views.py | 47 ++++++ app/unused_apps/guides/__init__.py | 0 app/unused_apps/guides/admin.py | 67 ++++++++ app/unused_apps/guides/build.py | 22 +++ app/unused_apps/guides/guide_urls.py | 18 ++ app/unused_apps/guides/migrations/0001_initial.py | 60 +++++++ .../migrations/0002_remove_guide_category.py | 17 ++ .../guides/migrations/0003_guide_category.py | 21 +++ .../guides/migrations/0004_auto_20190914_0646.py | 47 ++++++ .../migrations/0005_remove_guide_category.py | 17 ++ app/unused_apps/guides/migrations/__init__.py | 0 app/unused_apps/guides/models.py | 136 +++++++++++++++ app/unused_apps/guides/review_urls.py | 18 ++ .../guides/templates/guides/guide_detail.html | 176 ++++++++++++++++++++ .../guides/templates/guides/guide_detail.txt | 8 + .../guides/templates/guides/guide_list.html | 40 +++++ app/unused_apps/guides/urls.py | 34 ++++ app/unused_apps/guides/views.py | 62 +++++++ .../sketches/migrations/0003_auto_20190303_1057.py | 24 +++ config/base_urls.py | 5 +- design/sass/_archives.scss | 13 ++ design/sass/_comments.scss | 10 ++ design/sass/_details.scss | 14 ++ design/sass/_fonts.scss | 7 + design/sass/_global.scss | 2 +- design/sass/_mixins.scss | 6 +- design/templates/base.html | 2 +- 81 files changed, 1663 insertions(+), 524 deletions(-) delete mode 100644 app/essays/__init__.py delete mode 100644 app/essays/admin.py delete mode 100644 app/essays/build.py delete mode 100644 app/essays/migrations/0001_initial.py delete mode 100644 app/essays/migrations/0002_auto_20190204_1541.py delete mode 100644 app/essays/migrations/0003_essay_afterword_html.py delete mode 100644 app/essays/migrations/0004_auto_20190205_0830.py delete mode 100644 app/essays/migrations/0005_auto_20190208_0946.py delete mode 100644 app/essays/migrations/0006_auto_20190303_1625.py delete mode 100644 app/essays/migrations/0006_remove_essay_has_video.py delete mode 100644 app/essays/migrations/0007_auto_20190414_1455.py delete mode 100644 app/essays/migrations/0007_essay_has_video.py delete mode 100644 app/essays/migrations/0008_merge_20190303_1638.py delete mode 100644 app/essays/migrations/0009_merge_20190414_1500.py delete mode 100644 app/essays/migrations/0010_essay_field_notes.py delete mode 100644 app/essays/migrations/__init__.py delete mode 100644 app/essays/models.py delete mode 100644 app/essays/urls.py delete mode 100644 app/essays/views.py create mode 100644 app/posts/migrations/0006_post_short_title.py create mode 100644 app/posts/migrations/0007_auto_20191007_0949.py create mode 100644 app/posts/migrations/0008_post_topics.py create mode 100644 app/posts/templates/posts/guide_detail.html create mode 100644 app/src/migrations/0004_auto_20191007_0905.py create mode 100644 app/taxonomy/migrations/0002_auto_20191007_0913.py create mode 100644 app/taxonomy/urls.py create mode 100644 app/taxonomy/views.py create mode 100644 app/unused_apps/essays/__init__.py create mode 100644 app/unused_apps/essays/admin.py create mode 100644 app/unused_apps/essays/build.py create mode 100644 app/unused_apps/essays/migrations/0001_initial.py create mode 100644 app/unused_apps/essays/migrations/0002_auto_20190204_1541.py create mode 100644 app/unused_apps/essays/migrations/0003_essay_afterword_html.py create mode 100644 app/unused_apps/essays/migrations/0004_auto_20190205_0830.py create mode 100644 app/unused_apps/essays/migrations/0005_auto_20190208_0946.py create mode 100644 app/unused_apps/essays/migrations/0006_auto_20190303_1625.py create mode 100644 app/unused_apps/essays/migrations/0006_remove_essay_has_video.py create mode 100644 app/unused_apps/essays/migrations/0007_auto_20190414_1455.py create mode 100644 app/unused_apps/essays/migrations/0007_essay_has_video.py create mode 100644 app/unused_apps/essays/migrations/0008_merge_20190303_1638.py create mode 100644 app/unused_apps/essays/migrations/0009_merge_20190414_1500.py create mode 100644 app/unused_apps/essays/migrations/0010_essay_field_notes.py create mode 100644 app/unused_apps/essays/migrations/__init__.py create mode 100644 app/unused_apps/essays/models.py create mode 100644 app/unused_apps/essays/urls.py create mode 100644 app/unused_apps/essays/views.py create mode 100644 app/unused_apps/guides/__init__.py create mode 100644 app/unused_apps/guides/admin.py create mode 100644 app/unused_apps/guides/build.py create mode 100644 app/unused_apps/guides/guide_urls.py create mode 100644 app/unused_apps/guides/migrations/0001_initial.py create mode 100644 app/unused_apps/guides/migrations/0002_remove_guide_category.py create mode 100644 app/unused_apps/guides/migrations/0003_guide_category.py create mode 100644 app/unused_apps/guides/migrations/0004_auto_20190914_0646.py create mode 100644 app/unused_apps/guides/migrations/0005_remove_guide_category.py create mode 100644 app/unused_apps/guides/migrations/__init__.py create mode 100644 app/unused_apps/guides/models.py create mode 100644 app/unused_apps/guides/review_urls.py create mode 100644 app/unused_apps/guides/templates/guides/guide_detail.html create mode 100644 app/unused_apps/guides/templates/guides/guide_detail.txt create mode 100644 app/unused_apps/guides/templates/guides/guide_list.html create mode 100644 app/unused_apps/guides/urls.py create mode 100644 app/unused_apps/guides/views.py create mode 100644 app/unused_apps/sketches/migrations/0003_auto_20190303_1057.py diff --git a/app/essays/__init__.py b/app/essays/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/essays/admin.py b/app/essays/admin.py deleted file mode 100644 index ed39ca3..0000000 --- a/app/essays/admin.py +++ /dev/null @@ -1,47 +0,0 @@ -from django.contrib import admin - -from utils.widgets import LGEntryForm - -from .models import Essay - - -@admin.register(Essay) -class EssayAdmin(admin.ModelAdmin): - form = LGEntryForm - list_display = ('title', 'pub_date', 'enable_comments', 'status') - list_filter = ('pub_date', 'enable_comments', 'status') - prepopulated_fields = {"slug": ('title',)} - fieldsets = ( - ('Entry', { - 'fields': ( - 'title', - 'sub_title', - 'body_markdown', - ('pub_date', 'status'), - 'meta_description', - ('slug', 'enable_comments', 'has_code'), - ), - 'classes': ( - 'show', - 'extrapretty', - 'wide' - ) - }), - ('meta', { - 'fields': ( - 'originally_published_by', - 'originally_published_by_url', - 'afterword', - 'preamble', - ('field_notes', 'books'), - ), - 'classes': ( - 'hide', - 'extrapretty', - 'wide' - ) - }), - ) - - class Media: - js = ('image-loader.js', 'next-prev-links.js') diff --git a/app/essays/build.py b/app/essays/build.py deleted file mode 100644 index 392e991..0000000 --- a/app/essays/build.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -from builder.base import BuildNew -from django.urls import reverse -from . import models - - -class BuildEssays(BuildNew): - - def build(self): - self.build_list_view() - self.build_detail_view() - # These are the unique classes for this model: - #self.build_feed("src:feed") - - def build_list_view(self): - response = self.client.get('/essays/') - self.write_file('essays/', response.content) - - -def essaybuilder(): - j = BuildEssays("essays", "essay") - j.build() diff --git a/app/essays/migrations/0001_initial.py b/app/essays/migrations/0001_initial.py deleted file mode 100644 index 7b7ea62..0000000 --- a/app/essays/migrations/0001_initial.py +++ /dev/null @@ -1,49 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-04 14:08 - -from django.db import migrations, models -import django.db.models.deletion -import taggit.managers - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('photos', '0018_auto_20161130_1218'), - ('books', '0007_auto_20190131_2351'), - ('taxonomy', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='Essay', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=200)), - ('sub_title', models.CharField(blank=True, max_length=200)), - ('dek', models.TextField(blank=True)), - ('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')), - ('last_updated', models.DateTimeField(auto_now=True)), - ('enable_comments', models.BooleanField(default=False)), - ('has_code', models.BooleanField(default=False)), - ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0)), - ('meta_description', models.CharField(blank=True, max_length=256, null=True)), - ('post_type', models.IntegerField(choices=[(0, 'essay'), (1, 'tools'), (2, 'figment')], default=0)), - ('elsewhere', models.CharField(blank=True, max_length=400)), - ('has_video', models.BooleanField(blank=True, default=False)), - ('afterword', models.TextField(blank=True)), - ('books', models.ManyToManyField(blank=True, to='books.Book')), - ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage')), - ('tags', taggit.managers.TaggableManager(blank=True, help_text='Topics Covered', through='taxonomy.TaggedItems', to='taxonomy.LuxTag', verbose_name='Tags')), - ], - options={ - 'verbose_name_plural': 'Essays', - 'ordering': ('-pub_date',), - 'get_latest_by': 'pub_date', - }, - ), - ] diff --git a/app/essays/migrations/0002_auto_20190204_1541.py b/app/essays/migrations/0002_auto_20190204_1541.py deleted file mode 100644 index f4e6744..0000000 --- a/app/essays/migrations/0002_auto_20190204_1541.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-04 15:41 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0001_initial'), - ] - - operations = [ - migrations.RenameField( - model_name='essay', - old_name='elsewhere', - new_name='originally_published_by', - ), - migrations.AddField( - model_name='essay', - name='originally_published_by_url', - field=models.CharField(blank=True, max_length=400), - ), - ] diff --git a/app/essays/migrations/0003_essay_afterword_html.py b/app/essays/migrations/0003_essay_afterword_html.py deleted file mode 100644 index 5f8301b..0000000 --- a/app/essays/migrations/0003_essay_afterword_html.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-04 16:11 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0002_auto_20190204_1541'), - ] - - operations = [ - migrations.AddField( - model_name='essay', - name='afterword_html', - field=models.TextField(blank=True), - ), - ] diff --git a/app/essays/migrations/0004_auto_20190205_0830.py b/app/essays/migrations/0004_auto_20190205_0830.py deleted file mode 100644 index 65e2e5d..0000000 --- a/app/essays/migrations/0004_auto_20190205_0830.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-05 08:30 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0003_essay_afterword_html'), - ] - - operations = [ - migrations.CreateModel( - name='PostType', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=200)), - ('dek', models.TextField(blank=True)), - ('slug', models.SlugField()), - ], - ), - migrations.AlterField( - model_name='essay', - name='post_type', - field=models.IntegerField(choices=[(0, 'essays'), (1, 'tools'), (2, 'figments')], default=0), - ), - ] diff --git a/app/essays/migrations/0005_auto_20190208_0946.py b/app/essays/migrations/0005_auto_20190208_0946.py deleted file mode 100644 index 5b68bb4..0000000 --- a/app/essays/migrations/0005_auto_20190208_0946.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-08 09:46 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0004_auto_20190205_0830'), - ] - - operations = [ - migrations.DeleteModel( - name='PostType', - ), - migrations.RemoveField( - model_name='essay', - name='post_type', - ), - migrations.AddField( - model_name='essay', - name='preamble', - field=models.TextField(blank=True), - ), - ] diff --git a/app/essays/migrations/0006_auto_20190303_1625.py b/app/essays/migrations/0006_auto_20190303_1625.py deleted file mode 100644 index dde70fd..0000000 --- a/app/essays/migrations/0006_auto_20190303_1625.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.7 on 2019-03-03 16:25 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0005_auto_20190208_0946'), - ] - - operations = [ - migrations.AlterField( - model_name='essay', - name='field_notes', - field=models.ManyToManyField(blank=True, to='fieldnotes.FieldNote'), - ), - ] diff --git a/app/essays/migrations/0006_remove_essay_has_video.py b/app/essays/migrations/0006_remove_essay_has_video.py deleted file mode 100644 index 0842d8b..0000000 --- a/app/essays/migrations/0006_remove_essay_has_video.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.1.2 on 2019-02-27 21:22 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0005_auto_20190208_0946'), - ] - - operations = [ - migrations.RemoveField( - model_name='essay', - name='has_video', - ), - ] diff --git a/app/essays/migrations/0007_auto_20190414_1455.py b/app/essays/migrations/0007_auto_20190414_1455.py deleted file mode 100644 index a5242cb..0000000 --- a/app/essays/migrations/0007_auto_20190414_1455.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.7 on 2019-04-14 14:55 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0006_auto_20190303_1625'), - ] - - operations = [ - migrations.AddField( - model_name='essay', - name='preamble_html', - field=models.TextField(blank=True), - ), - ] diff --git a/app/essays/migrations/0007_essay_has_video.py b/app/essays/migrations/0007_essay_has_video.py deleted file mode 100644 index 0057e95..0000000 --- a/app/essays/migrations/0007_essay_has_video.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.2 on 2019-02-27 21:22 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0006_remove_essay_has_video'), - ] - - operations = [ - migrations.AddField( - model_name='essay', - name='has_video', - field=models.BooleanField(blank=True, default=False), - ), - ] diff --git a/app/essays/migrations/0008_merge_20190303_1638.py b/app/essays/migrations/0008_merge_20190303_1638.py deleted file mode 100644 index 7c155d8..0000000 --- a/app/essays/migrations/0008_merge_20190303_1638.py +++ /dev/null @@ -1,14 +0,0 @@ -# Generated by Django 2.1.2 on 2019-03-03 16:38 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0007_essay_has_video'), - ('essays', '0006_auto_20190303_1625'), - ] - - operations = [ - ] diff --git a/app/essays/migrations/0009_merge_20190414_1500.py b/app/essays/migrations/0009_merge_20190414_1500.py deleted file mode 100644 index 83a8323..0000000 --- a/app/essays/migrations/0009_merge_20190414_1500.py +++ /dev/null @@ -1,14 +0,0 @@ -# Generated by Django 2.1.2 on 2019-04-14 15:00 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('essays', '0008_merge_20190303_1638'), - ('essays', '0007_auto_20190414_1455'), - ] - - operations = [ - ] diff --git a/app/essays/migrations/0010_essay_field_notes.py b/app/essays/migrations/0010_essay_field_notes.py deleted file mode 100644 index ca15b38..0000000 --- a/app/essays/migrations/0010_essay_field_notes.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.1.7 on 2019-07-04 09:03 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('fieldnotes', '0002_auto_20190303_1222'), - ('essays', '0009_merge_20190414_1500'), - ] - - operations = [ - migrations.AddField( - model_name='essay', - name='field_notes', - field=models.ManyToManyField(blank=True, to='fieldnotes.FieldNote'), - ), - ] diff --git a/app/essays/migrations/__init__.py b/app/essays/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/essays/models.py b/app/essays/models.py deleted file mode 100644 index c75f72d..0000000 --- a/app/essays/models.py +++ /dev/null @@ -1,91 +0,0 @@ -from django.db import models -from django.urls import reverse -from django.contrib.sitemaps import Sitemap -import datetime -from itertools import chain - -from taggit.managers import TaggableManager - -from taxonomy.models import TaggedItems -from utils.util import render_images, markdown_to_html -from fieldnotes.models import FieldNote -from books.models import Book -from photos.models import LuxImage - - -POST_TYPE = ( - (0, 'essays'), - (1, 'tools'), - (2, 'figments'), -) - - -class Essay(models.Model): - title = models.CharField(max_length=200) - sub_title = models.CharField(max_length=200, blank=True) - dek = models.TextField(blank=True) - preamble = models.TextField(blank=True) - preamble_html = models.TextField(blank=True) - slug = models.SlugField(unique_for_date='pub_date') - body_html = models.TextField(blank=True) - body_markdown = models.TextField() - pub_date = models.DateTimeField('Date published') - last_updated = models.DateTimeField(auto_now=True) - enable_comments = models.BooleanField(default=False) - has_code = models.BooleanField(default=False) - PUB_STATUS = ( - (0, 'Draft'), - (1, 'Published'), - ) - status = models.IntegerField(choices=PUB_STATUS, default=0) - meta_description = models.CharField(max_length=256, null=True, blank=True) - tags = TaggableManager(through=TaggedItems, blank=True, help_text='Topics Covered') - originally_published_by = models.CharField(max_length=400, blank=True) - originally_published_by_url = models.CharField(max_length=400, blank=True) - featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) - has_video = models.BooleanField(blank=True, default=False) - field_notes = models.ManyToManyField(FieldNote, blank=True) - books = models.ManyToManyField(Book, blank=True) - afterword = models.TextField(blank=True) - afterword_html = models.TextField(blank=True) - - class Meta: - ordering = ('-pub_date',) - get_latest_by = 'pub_date' - verbose_name_plural = 'Essays' - - def __str__(self): - return self.title - - def get_absolute_url(self): - return reverse('essays:detail', kwargs={"slug": self.slug}) - - def comment_period_open(self): - return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date - - @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 save(self): - md = render_images(self.body_markdown) - self.body_html = markdown_to_html(md) - self.afterword_html = markdown_to_html(self.afterword) - self.preamble_html = markdown_to_html(self.preamble) - super(Essay, self).save() - - -class EssaySitemap(Sitemap): - changefreq = "never" - priority = 1.0 - protocol = "https" - - def items(self): - return Essay.objects.filter(status=1) - - def lastmod(self, obj): - return obj.pub_date diff --git a/app/essays/urls.py b/app/essays/urls.py deleted file mode 100644 index 8216f06..0000000 --- a/app/essays/urls.py +++ /dev/null @@ -1,28 +0,0 @@ -from django.urls import path, re_path - -from . import views - -app_name = "essays" - -urlpatterns = [ - #path( - # r'topic/', - # views.TopicListView.as_view(), - # name="list_topics" - #), - path( - r'', - views.EntryDetailView.as_view(), - name="detail" - ), - path( - r'', - views.EntryDetailViewTXT.as_view(), - name="detail-txt" - ), - path( - r'', - views.EssayListView.as_view(), - name="list", - ), -] diff --git a/app/essays/views.py b/app/essays/views.py deleted file mode 100644 index f8c68c7..0000000 --- a/app/essays/views.py +++ /dev/null @@ -1,47 +0,0 @@ -from django.views.generic import ListView -from django.views.generic.detail import DetailView -from django.contrib.syndication.views import Feed - - -from .models import Essay - - -class EssayListView(ListView): - model = Essay - - def get_queryset(self, **kwargs): - qs = Essay.objects.filter(status=1) - return qs - - -class EntryDetailView(DetailView): - model = Essay - - -class EntryDetailViewTXT(EntryDetailView): - template_name = "essays/entry_detail.txt" - - -''' -class TopicListView(ListView): - template_name = 'archives/src_home.html' - - def queryset(self): - return Post.objects.filter(topics__slug=self.kwargs['slug']) - - def get_context_data(self, **kwargs): - # Call the base implementation first to get a context - context = super(TopicListView, self).get_context_data(**kwargs) - context['topic'] = Topic.objects.get(slug__exact=self.kwargs['slug']) - return context - - -class SrcRSSFeedView(Feed): - title = "luxagraf:src Code and Technology" - link = "/src/" - description = "Latest postings to luxagraf.net/src" - description_template = 'feeds/blog_description.html' - - def items(self): - return Post.objects.filter(status__exact=1).order_by('-pub_date')[:10] -''' diff --git a/app/links/admin.py b/app/links/admin.py index f967dde..136a851 100644 --- a/app/links/admin.py +++ b/app/links/admin.py @@ -26,7 +26,8 @@ class LinkAdmin(admin.ModelAdmin): ('Details', { 'fields': ( 'pub_date', - ('tags', 'image'), + ('oldtags', 'image'), + 'topics', 'status' ), 'classes': 'collapse' diff --git a/app/posts/admin.py b/app/posts/admin.py index ad8f509..a8831e7 100644 --- a/app/posts/admin.py +++ b/app/posts/admin.py @@ -35,15 +35,15 @@ class EntryAdmin(OSMGeoAdmin): field = super(EntryAdmin, self).formfield_for_dbfield(db_field, **kwargs) return field - list_display = ('title', 'post_type', 'pub_date', 'template_name', 'status', 'category') + list_display = ('title', 'post_type', 'pub_date', 'template_name', 'status',) search_fields = ['title', 'body_markdown'] prepopulated_fields = {"slug": ('title',)} - list_filter = ('pub_date', 'enable_comments', 'status', 'category') + list_filter = ('pub_date', 'enable_comments', 'status') filter_horizontal = ('related',) fieldsets = ( ('Entry', { 'fields': ( - 'title', + ('title', 'short_title'), 'subtitle', 'body_markdown', ('pub_date', 'status', 'post_type', 'old_id',), @@ -61,7 +61,7 @@ class EntryAdmin(OSMGeoAdmin): 'point', 'dek', 'meta_description', - ('category', 'tags'), + 'topics', 'template_name', 'enable_comments', 'featured_image', diff --git a/app/posts/migrations/0006_post_short_title.py b/app/posts/migrations/0006_post_short_title.py new file mode 100644 index 0000000..a364147 --- /dev/null +++ b/app/posts/migrations/0006_post_short_title.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.7 on 2019-09-27 20:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('posts', '0005_auto_20190918_1244'), + ] + + operations = [ + migrations.AddField( + model_name='post', + name='short_title', + field=models.CharField(default='blurk', max_length=200), + preserve_default=False, + ), + ] diff --git a/app/posts/migrations/0007_auto_20191007_0949.py b/app/posts/migrations/0007_auto_20191007_0949.py new file mode 100644 index 0000000..2d99da4 --- /dev/null +++ b/app/posts/migrations/0007_auto_20191007_0949.py @@ -0,0 +1,21 @@ +# Generated by Django 2.2.6 on 2019-10-07 09:49 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('posts', '0006_post_short_title'), + ] + + operations = [ + migrations.RemoveField( + model_name='post', + name='category', + ), + migrations.RemoveField( + model_name='post', + name='tags', + ), + ] diff --git a/app/posts/migrations/0008_post_topics.py b/app/posts/migrations/0008_post_topics.py new file mode 100644 index 0000000..cd867d8 --- /dev/null +++ b/app/posts/migrations/0008_post_topics.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.6 on 2019-10-07 09:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('taxonomy', '0002_auto_20191007_0913'), + ('posts', '0007_auto_20191007_0949'), + ] + + operations = [ + migrations.AddField( + model_name='post', + name='topics', + field=models.ManyToManyField(blank=True, to='taxonomy.Category'), + ), + ] diff --git a/app/posts/models.py b/app/posts/models.py index 1e1da1e..1d71ecb 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -36,6 +36,7 @@ from utils.util import render_images, parse_video, markdown_to_html class Post(models.Model): old_id = models.IntegerField(blank=True, null=True) title = models.CharField(max_length=200) + short_title = models.CharField(max_length=200) subtitle = models.CharField(max_length=200, blank=True) slug = models.SlugField(unique_for_date='pub_date') prologue_markdown = models.TextField(blank=True, null=True) @@ -70,9 +71,8 @@ class Post(models.Model): books = models.ManyToManyField(Book, blank=True) field_notes = models.ManyToManyField(FieldNote, blank=True) related = models.ManyToManyField(RelatedPost, blank=True) - tags = TaggableManager(through=TaggedItems, blank=True, help_text='Topics Covered') - category = models.ForeignKey(Category, on_delete=models.CASCADE, null=True, blank=True) point = models.PointField(null=True, blank=True) + topics = models.ManyToManyField(Category, blank=True) location = models.ForeignKey(Location, on_delete=models.CASCADE, null=True, blank=True) originally_published_by = models.CharField(max_length=400, null=True, blank=True) originally_published_by_url = models.CharField(max_length=400, null=True, blank=True) @@ -198,3 +198,15 @@ def post_save_events(sender, update_fields, created, instance, **kwargs): post_save.disconnect(post_save_events, sender=Post) instance.save() post_save.connect(post_save_events, sender=Post) + + +class PostSitemap(Sitemap): + changefreq = "never" + priority = 1.0 + protocol = "https" + + def items(self): + return Post.objects.filter(status=1) + + def lastmod(self, obj): + return obj.pub_date diff --git a/app/posts/templates/posts/guide_detail.html b/app/posts/templates/posts/guide_detail.html new file mode 100644 index 0000000..12fb7e1 --- /dev/null +++ b/app/posts/templates/posts/guide_detail.html @@ -0,0 +1,182 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load comments %} +{%block htmlclass%}class="detail single"{%endblock%} +{% block pagetitle %}{{object.title|title|smartypants|safe}} - by Scott Gilbertson{% endblock %} + +{% block metadescription %}{% autoescape on %}{{object.meta_description|striptags|safe}}{% endautoescape %}{% endblock %} +{%block extrahead%} +{% if object.has_code %} + +{%endif %} + + + + + + + + + + + + + + + {% if object.featured_image %} + {%endif%} + +{%endblock%} + +{%block bodyid %}{% if object.get_post_type_display == 'tools' %}class="src"{% endif %}{%endblock%} + +{% block primary %} +
+ +
+
+

{%if object.template_name == 1 or object.template_name == 3 %}{{object.title|smartypants|safe}}{%else%}{{object.title|smartypants|safe}}{%endif%}

+

{{object.sub_title|smartypants|safe}}

+
+ {% if object.originally_published_by %}

Originally Published By: {{object.originally_published_by}}

{%endif%} + {% if object.location %}
+

{% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state_name|safe}}, U.S.{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name|safe}}{%endif%}

+ – Map +
{%endif%} +

Filed Under: Guides, {% for tag in object.tags.all %}{{tag}}{%endfor%}

+ + +
+
+
+ {% if object.preamble %}
+ {{object.preamble_html|smartypants|safe}} +
{%endif%} + {{object.body_html|safe|smartypants}} +
+ {% if object.afterword_html %}
+

Afterward

+ {{object.afterword_html|smartypants|safe}} +
{%endif%} + {%if wildlife or object.field_notes.all or object.books.all %}{%endif%} +
+ + {% comment %}
+
If you enjoyed this, you should join the mailing list…
+ {% include 'mailing_list.html' %} +
{% endcomment %} +
+ {% if object.enable_comments %} +{% get_comment_count for object as comment_count %} +{%if comment_count > 0 %} +

{{comment_count}} Comment{{ comment_count|pluralize }}

+{% render_comment_list for object %} +{%endif%} +{% render_comment_form for object %} +{% else %} +

Sorry, comments have been disabled for this post.

+{%endif%} +{% endblock %} +{% block js %} + +{%endblock%} diff --git a/app/posts/templates/posts/post_list.html b/app/posts/templates/posts/post_list.html index a264a11..9ec3e25 100644 --- a/app/posts/templates/posts/post_list.html +++ b/app/posts/templates/posts/post_list.html @@ -2,19 +2,21 @@ {% load typogrify_tags %} {% load html5_datetime %} {% load pagination_tags %} -{% block pagetitle %}Guides for the Perplexed{% endblock %} -{% block metadescription %}Guides for fellow travelers: tools, tips, and tricks to make life on the road easier.{% endblock %} +{% block pagetitle %}Advice, Tools, Tips, and Tricks for Full Time Van or RV Life.{% endblock %} +{% block metadescription %}Guides for fellow travelers: tools, tips, and tricks to make life on the road in an RV or Van easier and more enjoyable.{% endblock %} {% block primary %}

Guides for fellow travelers

-

The less stuff you travel with the better off you will be, up to a point. But where is that point? What's enough? What's too much? That point is what I'm trying to discover here.

-

What do you really need? What's worth having? What's not?

-

Topics include {% for topic in topic_list %}{{topic}}, {% endfor %}travel, cooking, photography, writing, simplicity, and once, coffee.

+

Advice, Tools, Tips, and Tricks for Full Time Van or RV Life.

+

After {{years_on_the_road}} years on the road, here's what I know: all you really need is a van or RV, a way to cook, and way to keep food cool.

+

After that, it's all luxury. The less stuff you travel with the better off you will be. Well, up to a point. But where is that point? What do you really need? What should you skip? What's enough? What's too much?

+

Ultimately, these are questions you'll have to answer for yourself, and you won't answer them until you get out there and start living on the road full time. In the mean time, this is me answering those questions for myself, and hoping maybe it will help you find your own answers faster.

+

Topics include {% for topic in topic_list %}{{topic}}, {% endfor %}camping, cooking, photography, simplicity, and once or twice, coffee.

Guides

{% autopaginate object_list 30 %} diff --git a/app/posts/views.py b/app/posts/views.py index 0324d16..fc85fa7 100644 --- a/app/posts/views.py +++ b/app/posts/views.py @@ -26,6 +26,11 @@ class GuidesListView(PostList): def get_queryset(self): queryset = super(GuidesListView, self).get_queryset() return queryset.filter(post_type__in=[0,1]).filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image') + + def get_context_data(self, **kwargs): + context = super(GuidesListView, self).get_context_data(**kwargs) + context['archive_type'] = 'Guides' + return context class EssayListView(PostList): @@ -53,6 +58,9 @@ class PostDetailView(DetailView): context['related'] = related return context + def get_template_names(self): + obj = self.get_object() + return ["posts/%s_detail.html" % obj.get_post_type_display(), 'posts/post_detail.html'] class PostDetailViewTXT(PostDetailView): template_name = "posts/entry_detail.txt" diff --git a/app/src/admin.py b/app/src/admin.py index 815267c..f354b15 100644 --- a/app/src/admin.py +++ b/app/src/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from .models import Topic, Post, Book +from .models import Topic, SrcPost, Book from utils.widgets import LGEntryForm @@ -33,7 +33,7 @@ class BookAdmin(admin.ModelAdmin): ) -@admin.register(Post) +@admin.register(SrcPost) class PostAdmin(admin.ModelAdmin): form = LGEntryForm list_display = ('title', 'pub_date', 'enable_comments', 'status') diff --git a/app/src/migrations/0004_auto_20191007_0905.py b/app/src/migrations/0004_auto_20191007_0905.py new file mode 100644 index 0000000..6c223a0 --- /dev/null +++ b/app/src/migrations/0004_auto_20191007_0905.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.6 on 2019-10-07 09:05 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('src', '0003_auto_20180707_0958'), + ] + + operations = [ + migrations.RenameModel( + old_name='Post', + new_name='SrcPost', + ), + ] diff --git a/app/src/models.py b/app/src/models.py index 90d58e4..2c9707e 100644 --- a/app/src/models.py +++ b/app/src/models.py @@ -30,7 +30,7 @@ class Topic(models.Model): return datetime.datetime.now() -class Post(models.Model): +class SrcPost(models.Model): title = models.CharField(max_length=200) slug = models.SlugField(unique_for_date='pub_date') body_html = models.TextField(blank=True) diff --git a/app/src/views.py b/app/src/views.py index f501637..f929949 100644 --- a/app/src/views.py +++ b/app/src/views.py @@ -6,7 +6,7 @@ from django.conf import settings #from paypal.standard.forms import PayPalPaymentsForm -from .models import Post, Topic, Book +from .models import SrcPost, Topic, Book class BookListView(ListView): @@ -47,7 +47,7 @@ class BookDetailView(DetailView): class SrcListView(ListView): def get_queryset(self): - return Post.objects.filter(status__exact=1) + return SrcPost.objects.filter(status__exact=1) def get_context_data(self, **kwargs): # Call the base implementation first to get a context @@ -57,7 +57,7 @@ class SrcListView(ListView): class EntryDetailView(DetailView): - model = Post + model = SrcPost slug_field = "slug" @@ -69,7 +69,7 @@ class TopicListView(ListView): template_name = 'src/topic_list.html' def get_queryset(self): - return Post.objects.filter(topics__slug=self.kwargs['slug']) + return SrcPost.objects.filter(topics__slug=self.kwargs['slug']) def get_context_data(self, **kwargs): # Call the base implementation first to get a context @@ -85,4 +85,4 @@ class SrcRSSFeedView(Feed): description_template = 'feeds/blog_description.html' def items(self): - return Post.objects.filter(status__exact=1).order_by('-pub_date')[:10] + return SrcPost.objects.filter(status__exact=1).order_by('-pub_date')[:10] diff --git a/app/taxonomy/migrations/0002_auto_20191007_0913.py b/app/taxonomy/migrations/0002_auto_20191007_0913.py new file mode 100644 index 0000000..fb53007 --- /dev/null +++ b/app/taxonomy/migrations/0002_auto_20191007_0913.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.6 on 2019-10-07 09:13 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('taxonomy', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='category', + options={'verbose_name': 'Category', 'verbose_name_plural': 'Categories'}, + ), + ] diff --git a/app/taxonomy/models.py b/app/taxonomy/models.py index 18d7ae3..9479a7f 100644 --- a/app/taxonomy/models.py +++ b/app/taxonomy/models.py @@ -16,7 +16,7 @@ class LuxTag(TagBase): @cached_property def get_absolute_url(self): - return reverse("taxonomy:tags", kwargs={"slug": self.slug}) + return reverse("taxonomy:cat-detail", kwargs={"slug": self.slug}) class TaggedItems(GenericTaggedItemBase): @@ -40,4 +40,4 @@ class Category(models.Model): verbose_name_plural = _("Categories") def get_absolute_url(self): - return reverse("taxonomy:categories", kwargs={"slug": self.slug}) + return reverse("taxonomy:cat-detail", kwargs={"slug": self.slug}) diff --git a/app/taxonomy/urls.py b/app/taxonomy/urls.py new file mode 100644 index 0000000..882bd52 --- /dev/null +++ b/app/taxonomy/urls.py @@ -0,0 +1,13 @@ +from django.urls import path, re_path + +from . import views + +app_name = "taxonomy" + +urlpatterns = [ + path( + r'', + views.CategoryDetailView.as_view(), + name="cat-detail" + ), +] diff --git a/app/taxonomy/views.py b/app/taxonomy/views.py new file mode 100644 index 0000000..2d749ab --- /dev/null +++ b/app/taxonomy/views.py @@ -0,0 +1,14 @@ +from django.views.generic import ListView +from django.views.generic.detail import DetailView +from django.contrib.syndication.views import Feed +from django.urls import reverse +from django.conf import settings + +#from paypal.standard.forms import PayPalPaymentsForm + +from .models import Category + + +class CategoryDetailView(DetailView): + model = Category + slug_field = "slug" diff --git a/app/unused_apps/essays/__init__.py b/app/unused_apps/essays/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/unused_apps/essays/admin.py b/app/unused_apps/essays/admin.py new file mode 100644 index 0000000..ed39ca3 --- /dev/null +++ b/app/unused_apps/essays/admin.py @@ -0,0 +1,47 @@ +from django.contrib import admin + +from utils.widgets import LGEntryForm + +from .models import Essay + + +@admin.register(Essay) +class EssayAdmin(admin.ModelAdmin): + form = LGEntryForm + list_display = ('title', 'pub_date', 'enable_comments', 'status') + list_filter = ('pub_date', 'enable_comments', 'status') + prepopulated_fields = {"slug": ('title',)} + fieldsets = ( + ('Entry', { + 'fields': ( + 'title', + 'sub_title', + 'body_markdown', + ('pub_date', 'status'), + 'meta_description', + ('slug', 'enable_comments', 'has_code'), + ), + 'classes': ( + 'show', + 'extrapretty', + 'wide' + ) + }), + ('meta', { + 'fields': ( + 'originally_published_by', + 'originally_published_by_url', + 'afterword', + 'preamble', + ('field_notes', 'books'), + ), + 'classes': ( + 'hide', + 'extrapretty', + 'wide' + ) + }), + ) + + class Media: + js = ('image-loader.js', 'next-prev-links.js') diff --git a/app/unused_apps/essays/build.py b/app/unused_apps/essays/build.py new file mode 100644 index 0000000..392e991 --- /dev/null +++ b/app/unused_apps/essays/build.py @@ -0,0 +1,22 @@ +import os +from builder.base import BuildNew +from django.urls import reverse +from . import models + + +class BuildEssays(BuildNew): + + def build(self): + self.build_list_view() + self.build_detail_view() + # These are the unique classes for this model: + #self.build_feed("src:feed") + + def build_list_view(self): + response = self.client.get('/essays/') + self.write_file('essays/', response.content) + + +def essaybuilder(): + j = BuildEssays("essays", "essay") + j.build() diff --git a/app/unused_apps/essays/migrations/0001_initial.py b/app/unused_apps/essays/migrations/0001_initial.py new file mode 100644 index 0000000..7b7ea62 --- /dev/null +++ b/app/unused_apps/essays/migrations/0001_initial.py @@ -0,0 +1,49 @@ +# Generated by Django 2.1.5 on 2019-02-04 14:08 + +from django.db import migrations, models +import django.db.models.deletion +import taggit.managers + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('photos', '0018_auto_20161130_1218'), + ('books', '0007_auto_20190131_2351'), + ('taxonomy', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Essay', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('sub_title', models.CharField(blank=True, max_length=200)), + ('dek', models.TextField(blank=True)), + ('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')), + ('last_updated', models.DateTimeField(auto_now=True)), + ('enable_comments', models.BooleanField(default=False)), + ('has_code', models.BooleanField(default=False)), + ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0)), + ('meta_description', models.CharField(blank=True, max_length=256, null=True)), + ('post_type', models.IntegerField(choices=[(0, 'essay'), (1, 'tools'), (2, 'figment')], default=0)), + ('elsewhere', models.CharField(blank=True, max_length=400)), + ('has_video', models.BooleanField(blank=True, default=False)), + ('afterword', models.TextField(blank=True)), + ('books', models.ManyToManyField(blank=True, to='books.Book')), + ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage')), + ('tags', taggit.managers.TaggableManager(blank=True, help_text='Topics Covered', through='taxonomy.TaggedItems', to='taxonomy.LuxTag', verbose_name='Tags')), + ], + options={ + 'verbose_name_plural': 'Essays', + 'ordering': ('-pub_date',), + 'get_latest_by': 'pub_date', + }, + ), + ] diff --git a/app/unused_apps/essays/migrations/0002_auto_20190204_1541.py b/app/unused_apps/essays/migrations/0002_auto_20190204_1541.py new file mode 100644 index 0000000..f4e6744 --- /dev/null +++ b/app/unused_apps/essays/migrations/0002_auto_20190204_1541.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1.5 on 2019-02-04 15:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0001_initial'), + ] + + operations = [ + migrations.RenameField( + model_name='essay', + old_name='elsewhere', + new_name='originally_published_by', + ), + migrations.AddField( + model_name='essay', + name='originally_published_by_url', + field=models.CharField(blank=True, max_length=400), + ), + ] diff --git a/app/unused_apps/essays/migrations/0003_essay_afterword_html.py b/app/unused_apps/essays/migrations/0003_essay_afterword_html.py new file mode 100644 index 0000000..5f8301b --- /dev/null +++ b/app/unused_apps/essays/migrations/0003_essay_afterword_html.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-02-04 16:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0002_auto_20190204_1541'), + ] + + operations = [ + migrations.AddField( + model_name='essay', + name='afterword_html', + field=models.TextField(blank=True), + ), + ] diff --git a/app/unused_apps/essays/migrations/0004_auto_20190205_0830.py b/app/unused_apps/essays/migrations/0004_auto_20190205_0830.py new file mode 100644 index 0000000..65e2e5d --- /dev/null +++ b/app/unused_apps/essays/migrations/0004_auto_20190205_0830.py @@ -0,0 +1,27 @@ +# Generated by Django 2.1.5 on 2019-02-05 08:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0003_essay_afterword_html'), + ] + + operations = [ + migrations.CreateModel( + name='PostType', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=200)), + ('dek', models.TextField(blank=True)), + ('slug', models.SlugField()), + ], + ), + migrations.AlterField( + model_name='essay', + name='post_type', + field=models.IntegerField(choices=[(0, 'essays'), (1, 'tools'), (2, 'figments')], default=0), + ), + ] diff --git a/app/unused_apps/essays/migrations/0005_auto_20190208_0946.py b/app/unused_apps/essays/migrations/0005_auto_20190208_0946.py new file mode 100644 index 0000000..5b68bb4 --- /dev/null +++ b/app/unused_apps/essays/migrations/0005_auto_20190208_0946.py @@ -0,0 +1,25 @@ +# Generated by Django 2.1.5 on 2019-02-08 09:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0004_auto_20190205_0830'), + ] + + operations = [ + migrations.DeleteModel( + name='PostType', + ), + migrations.RemoveField( + model_name='essay', + name='post_type', + ), + migrations.AddField( + model_name='essay', + name='preamble', + field=models.TextField(blank=True), + ), + ] diff --git a/app/unused_apps/essays/migrations/0006_auto_20190303_1625.py b/app/unused_apps/essays/migrations/0006_auto_20190303_1625.py new file mode 100644 index 0000000..dde70fd --- /dev/null +++ b/app/unused_apps/essays/migrations/0006_auto_20190303_1625.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.7 on 2019-03-03 16:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0005_auto_20190208_0946'), + ] + + operations = [ + migrations.AlterField( + model_name='essay', + name='field_notes', + field=models.ManyToManyField(blank=True, to='fieldnotes.FieldNote'), + ), + ] diff --git a/app/unused_apps/essays/migrations/0006_remove_essay_has_video.py b/app/unused_apps/essays/migrations/0006_remove_essay_has_video.py new file mode 100644 index 0000000..0842d8b --- /dev/null +++ b/app/unused_apps/essays/migrations/0006_remove_essay_has_video.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.2 on 2019-02-27 21:22 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0005_auto_20190208_0946'), + ] + + operations = [ + migrations.RemoveField( + model_name='essay', + name='has_video', + ), + ] diff --git a/app/unused_apps/essays/migrations/0007_auto_20190414_1455.py b/app/unused_apps/essays/migrations/0007_auto_20190414_1455.py new file mode 100644 index 0000000..a5242cb --- /dev/null +++ b/app/unused_apps/essays/migrations/0007_auto_20190414_1455.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.7 on 2019-04-14 14:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0006_auto_20190303_1625'), + ] + + operations = [ + migrations.AddField( + model_name='essay', + name='preamble_html', + field=models.TextField(blank=True), + ), + ] diff --git a/app/unused_apps/essays/migrations/0007_essay_has_video.py b/app/unused_apps/essays/migrations/0007_essay_has_video.py new file mode 100644 index 0000000..0057e95 --- /dev/null +++ b/app/unused_apps/essays/migrations/0007_essay_has_video.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.2 on 2019-02-27 21:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0006_remove_essay_has_video'), + ] + + operations = [ + migrations.AddField( + model_name='essay', + name='has_video', + field=models.BooleanField(blank=True, default=False), + ), + ] diff --git a/app/unused_apps/essays/migrations/0008_merge_20190303_1638.py b/app/unused_apps/essays/migrations/0008_merge_20190303_1638.py new file mode 100644 index 0000000..7c155d8 --- /dev/null +++ b/app/unused_apps/essays/migrations/0008_merge_20190303_1638.py @@ -0,0 +1,14 @@ +# Generated by Django 2.1.2 on 2019-03-03 16:38 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0007_essay_has_video'), + ('essays', '0006_auto_20190303_1625'), + ] + + operations = [ + ] diff --git a/app/unused_apps/essays/migrations/0009_merge_20190414_1500.py b/app/unused_apps/essays/migrations/0009_merge_20190414_1500.py new file mode 100644 index 0000000..83a8323 --- /dev/null +++ b/app/unused_apps/essays/migrations/0009_merge_20190414_1500.py @@ -0,0 +1,14 @@ +# Generated by Django 2.1.2 on 2019-04-14 15:00 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('essays', '0008_merge_20190303_1638'), + ('essays', '0007_auto_20190414_1455'), + ] + + operations = [ + ] diff --git a/app/unused_apps/essays/migrations/0010_essay_field_notes.py b/app/unused_apps/essays/migrations/0010_essay_field_notes.py new file mode 100644 index 0000000..ca15b38 --- /dev/null +++ b/app/unused_apps/essays/migrations/0010_essay_field_notes.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.7 on 2019-07-04 09:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fieldnotes', '0002_auto_20190303_1222'), + ('essays', '0009_merge_20190414_1500'), + ] + + operations = [ + migrations.AddField( + model_name='essay', + name='field_notes', + field=models.ManyToManyField(blank=True, to='fieldnotes.FieldNote'), + ), + ] diff --git a/app/unused_apps/essays/migrations/__init__.py b/app/unused_apps/essays/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/unused_apps/essays/models.py b/app/unused_apps/essays/models.py new file mode 100644 index 0000000..c75f72d --- /dev/null +++ b/app/unused_apps/essays/models.py @@ -0,0 +1,91 @@ +from django.db import models +from django.urls import reverse +from django.contrib.sitemaps import Sitemap +import datetime +from itertools import chain + +from taggit.managers import TaggableManager + +from taxonomy.models import TaggedItems +from utils.util import render_images, markdown_to_html +from fieldnotes.models import FieldNote +from books.models import Book +from photos.models import LuxImage + + +POST_TYPE = ( + (0, 'essays'), + (1, 'tools'), + (2, 'figments'), +) + + +class Essay(models.Model): + title = models.CharField(max_length=200) + sub_title = models.CharField(max_length=200, blank=True) + dek = models.TextField(blank=True) + preamble = models.TextField(blank=True) + preamble_html = models.TextField(blank=True) + slug = models.SlugField(unique_for_date='pub_date') + body_html = models.TextField(blank=True) + body_markdown = models.TextField() + pub_date = models.DateTimeField('Date published') + last_updated = models.DateTimeField(auto_now=True) + enable_comments = models.BooleanField(default=False) + has_code = models.BooleanField(default=False) + PUB_STATUS = ( + (0, 'Draft'), + (1, 'Published'), + ) + status = models.IntegerField(choices=PUB_STATUS, default=0) + meta_description = models.CharField(max_length=256, null=True, blank=True) + tags = TaggableManager(through=TaggedItems, blank=True, help_text='Topics Covered') + originally_published_by = models.CharField(max_length=400, blank=True) + originally_published_by_url = models.CharField(max_length=400, blank=True) + featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) + has_video = models.BooleanField(blank=True, default=False) + field_notes = models.ManyToManyField(FieldNote, blank=True) + books = models.ManyToManyField(Book, blank=True) + afterword = models.TextField(blank=True) + afterword_html = models.TextField(blank=True) + + class Meta: + ordering = ('-pub_date',) + get_latest_by = 'pub_date' + verbose_name_plural = 'Essays' + + def __str__(self): + return self.title + + def get_absolute_url(self): + return reverse('essays:detail', kwargs={"slug": self.slug}) + + def comment_period_open(self): + return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date + + @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 save(self): + md = render_images(self.body_markdown) + self.body_html = markdown_to_html(md) + self.afterword_html = markdown_to_html(self.afterword) + self.preamble_html = markdown_to_html(self.preamble) + super(Essay, self).save() + + +class EssaySitemap(Sitemap): + changefreq = "never" + priority = 1.0 + protocol = "https" + + def items(self): + return Essay.objects.filter(status=1) + + def lastmod(self, obj): + return obj.pub_date diff --git a/app/unused_apps/essays/urls.py b/app/unused_apps/essays/urls.py new file mode 100644 index 0000000..8216f06 --- /dev/null +++ b/app/unused_apps/essays/urls.py @@ -0,0 +1,28 @@ +from django.urls import path, re_path + +from . import views + +app_name = "essays" + +urlpatterns = [ + #path( + # r'topic/', + # views.TopicListView.as_view(), + # name="list_topics" + #), + path( + r'', + views.EntryDetailView.as_view(), + name="detail" + ), + path( + r'', + views.EntryDetailViewTXT.as_view(), + name="detail-txt" + ), + path( + r'', + views.EssayListView.as_view(), + name="list", + ), +] diff --git a/app/unused_apps/essays/views.py b/app/unused_apps/essays/views.py new file mode 100644 index 0000000..f8c68c7 --- /dev/null +++ b/app/unused_apps/essays/views.py @@ -0,0 +1,47 @@ +from django.views.generic import ListView +from django.views.generic.detail import DetailView +from django.contrib.syndication.views import Feed + + +from .models import Essay + + +class EssayListView(ListView): + model = Essay + + def get_queryset(self, **kwargs): + qs = Essay.objects.filter(status=1) + return qs + + +class EntryDetailView(DetailView): + model = Essay + + +class EntryDetailViewTXT(EntryDetailView): + template_name = "essays/entry_detail.txt" + + +''' +class TopicListView(ListView): + template_name = 'archives/src_home.html' + + def queryset(self): + return Post.objects.filter(topics__slug=self.kwargs['slug']) + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(TopicListView, self).get_context_data(**kwargs) + context['topic'] = Topic.objects.get(slug__exact=self.kwargs['slug']) + return context + + +class SrcRSSFeedView(Feed): + title = "luxagraf:src Code and Technology" + link = "/src/" + description = "Latest postings to luxagraf.net/src" + description_template = 'feeds/blog_description.html' + + def items(self): + return Post.objects.filter(status__exact=1).order_by('-pub_date')[:10] +''' diff --git a/app/unused_apps/guides/__init__.py b/app/unused_apps/guides/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/unused_apps/guides/admin.py b/app/unused_apps/guides/admin.py new file mode 100644 index 0000000..7895aba --- /dev/null +++ b/app/unused_apps/guides/admin.py @@ -0,0 +1,67 @@ +from django.contrib import admin +from django.contrib.gis.admin import OSMGeoAdmin + +from utils.widgets import LGEntryForm +from utils.util import get_latlon + +from .models import Guide + + +@admin.register(Guide) +class GuideAdmin(OSMGeoAdmin): + form = LGEntryForm + list_display = ('title', 'pub_date', 'enable_comments', 'status', 'post_type') + list_filter = ('pub_date', 'enable_comments', 'status') + prepopulated_fields = {"slug": ('title',)} + fieldsets = ( + ('Entry', { + 'fields': ( + 'title', + 'sub_title', + 'body_markdown', + ('pub_date', 'status', 'post_type', 'disclaimer'), + 'meta_description', + 'featured_image', + 'dek', + 'tags', + 'prologue_markdown', + 'epilogue_markdown', + 'has_video', + ('slug', 'enable_comments'), + 'point', + ), + 'classes': ( + 'show', + 'extrapretty', + 'wide' + ) + }), + ('meta', { + 'fields': ( + ('field_notes', 'books','jrnl'), + ), + 'classes': ( + 'hide', + 'extrapretty', + 'wide' + ) + }), + ) + + # options for OSM map Using custom ESRI topo map + lat, lon = get_latlon() + default_lon = lon + default_lat = lat + default_zoom = 10 + units = True + scrollable = False + map_width = 700 + map_height = 425 + map_template = 'gis/admin/osm.html' + openlayers_url = '/static/admin/js/OpenLayers.js' + + class Media: + js = ('image-loader.js', 'next-prev-links.js') + css = { + "all": ("my_styles.css",) + } diff --git a/app/unused_apps/guides/build.py b/app/unused_apps/guides/build.py new file mode 100644 index 0000000..392e991 --- /dev/null +++ b/app/unused_apps/guides/build.py @@ -0,0 +1,22 @@ +import os +from builder.base import BuildNew +from django.urls import reverse +from . import models + + +class BuildEssays(BuildNew): + + def build(self): + self.build_list_view() + self.build_detail_view() + # These are the unique classes for this model: + #self.build_feed("src:feed") + + def build_list_view(self): + response = self.client.get('/essays/') + self.write_file('essays/', response.content) + + +def essaybuilder(): + j = BuildEssays("essays", "essay") + j.build() diff --git a/app/unused_apps/guides/guide_urls.py b/app/unused_apps/guides/guide_urls.py new file mode 100644 index 0000000..ad67061 --- /dev/null +++ b/app/unused_apps/guides/guide_urls.py @@ -0,0 +1,18 @@ +from django.urls import path, re_path + +from . import views + +app_name = "guide" + +urlpatterns = [ + path( + r'', + views.GuideDetailView.as_view(), + name="guide-detail" + ), + path( + r'.txt', + views.GuideDetailViewTXT.as_view(), + name="guide-detail-txt" + ), +] diff --git a/app/unused_apps/guides/migrations/0001_initial.py b/app/unused_apps/guides/migrations/0001_initial.py new file mode 100644 index 0000000..833dfbe --- /dev/null +++ b/app/unused_apps/guides/migrations/0001_initial.py @@ -0,0 +1,60 @@ +# Generated by Django 2.1.7 on 2019-07-04 09:03 + +import django.contrib.gis.db.models.fields +from django.db import migrations, models +import django.db.models.deletion +import taggit.managers + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('jrnl', '0043_auto_20190704_0903'), + ('books', '0009_book_afflink'), + ('photos', '0019_auto_20190704_0903'), + ('fieldnotes', '0002_auto_20190303_1222'), + ('locations', '0018_auto_20190414_2124'), + ('essays', '0010_essay_field_notes'), + ('taxonomy', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Guide', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('sub_title', models.CharField(blank=True, max_length=200)), + ('dek', models.TextField(blank=True)), + ('preamble_markdown', models.TextField(blank=True)), + ('preamble_html', models.TextField(blank=True)), + ('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')), + ('last_updated', models.DateTimeField(auto_now=True)), + ('enable_comments', models.BooleanField(default=False)), + ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0)), + ('meta_description', models.CharField(blank=True, max_length=256, null=True)), + ('has_video', models.BooleanField(blank=True, default=False)), + ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)), + ('afterword', models.TextField(blank=True)), + ('afterword_html', models.TextField(blank=True)), + ('books', models.ManyToManyField(blank=True, to='books.Book')), + ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='taxonomy.Category')), + ('essays', models.ManyToManyField(blank=True, to='essays.Essay')), + ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage')), + ('field_notes', models.ManyToManyField(blank=True, to='fieldnotes.FieldNote')), + ('jrnl', models.ManyToManyField(blank=True, to='jrnl.Entry')), + ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), + ('tags', taggit.managers.TaggableManager(blank=True, help_text='Topics Covered', through='taxonomy.TaggedItems', to='taxonomy.LuxTag', verbose_name='Tags')), + ], + options={ + 'verbose_name_plural': 'Guides', + 'ordering': ('-pub_date',), + 'get_latest_by': 'pub_date', + }, + ), + ] diff --git a/app/unused_apps/guides/migrations/0002_remove_guide_category.py b/app/unused_apps/guides/migrations/0002_remove_guide_category.py new file mode 100644 index 0000000..76eefa6 --- /dev/null +++ b/app/unused_apps/guides/migrations/0002_remove_guide_category.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.7 on 2019-07-04 12:05 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('guides', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='guide', + name='category', + ), + ] diff --git a/app/unused_apps/guides/migrations/0003_guide_category.py b/app/unused_apps/guides/migrations/0003_guide_category.py new file mode 100644 index 0000000..82d03ac --- /dev/null +++ b/app/unused_apps/guides/migrations/0003_guide_category.py @@ -0,0 +1,21 @@ +# Generated by Django 2.1.7 on 2019-09-08 17:45 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('taxonomy', '0001_initial'), + ('guides', '0002_remove_guide_category'), + ] + + operations = [ + migrations.AddField( + model_name='guide', + name='category', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='taxonomy.Category'), + preserve_default=False, + ), + ] diff --git a/app/unused_apps/guides/migrations/0004_auto_20190914_0646.py b/app/unused_apps/guides/migrations/0004_auto_20190914_0646.py new file mode 100644 index 0000000..ccd79a5 --- /dev/null +++ b/app/unused_apps/guides/migrations/0004_auto_20190914_0646.py @@ -0,0 +1,47 @@ +# Generated by Django 2.1.7 on 2019-09-14 06:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('guides', '0003_guide_category'), + ] + + operations = [ + migrations.RenameField( + model_name='guide', + old_name='afterword', + new_name='epilogue_html', + ), + migrations.RenameField( + model_name='guide', + old_name='afterword_html', + new_name='epilogue_markdown', + ), + migrations.RenameField( + model_name='guide', + old_name='preamble_html', + new_name='prologue_html', + ), + migrations.RenameField( + model_name='guide', + old_name='preamble_markdown', + new_name='prologue_markdown', + ), + migrations.RemoveField( + model_name='guide', + name='essays', + ), + migrations.AddField( + model_name='guide', + name='disclaimer', + field=models.BooleanField(blank=True, default=False), + ), + migrations.AddField( + model_name='guide', + name='post_type', + field=models.IntegerField(choices=[(0, 'guide'), (1, 'review')], default=0), + ), + ] diff --git a/app/unused_apps/guides/migrations/0005_remove_guide_category.py b/app/unused_apps/guides/migrations/0005_remove_guide_category.py new file mode 100644 index 0000000..71d0280 --- /dev/null +++ b/app/unused_apps/guides/migrations/0005_remove_guide_category.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.7 on 2019-09-14 07:08 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('guides', '0004_auto_20190914_0646'), + ] + + operations = [ + migrations.RemoveField( + model_name='guide', + name='category', + ), + ] diff --git a/app/unused_apps/guides/migrations/__init__.py b/app/unused_apps/guides/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/unused_apps/guides/models.py b/app/unused_apps/guides/models.py new file mode 100644 index 0000000..8704887 --- /dev/null +++ b/app/unused_apps/guides/models.py @@ -0,0 +1,136 @@ +from django.contrib.gis.db import models +from django.urls import reverse +from django.contrib.sitemaps import Sitemap +import datetime +from itertools import chain + +from taggit.managers import TaggableManager + +from taxonomy.models import TaggedItems, Category +from utils.util import render_images, markdown_to_html +from fieldnotes.models import FieldNote +from books.models import Book +from locations.models import Location +from photos.models import LuxImage +from essays.models import Essay +from jrnl.models import Entry + + +class Guide(models.Model): + title = models.CharField(max_length=200) + sub_title = models.CharField(max_length=200, blank=True) + dek = models.TextField(blank=True) + prologue_markdown = models.TextField(blank=True) + prologue_html = models.TextField(blank=True) + body_markdown = models.TextField() + body_html = models.TextField(blank=True) + epilogue_markdown = models.TextField(blank=True) + epilogue_html = models.TextField(blank=True) + slug = models.SlugField(unique_for_date='pub_date') + pub_date = models.DateTimeField('Date published') + last_updated = models.DateTimeField(auto_now=True) + enable_comments = models.BooleanField(default=False) + PUB_STATUS = ( + (0, 'Draft'), + (1, 'Published'), + ) + status = models.IntegerField(choices=PUB_STATUS, default=0) + POST_TYPE = ( + (0, 'guide'), + (1, 'review'), + ) + post_type = models.IntegerField(choices=POST_TYPE, default=0) + meta_description = models.CharField(max_length=256, null=True, blank=True) + tags = TaggableManager(through=TaggedItems, blank=True, help_text='Topics Covered') + featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) + point = models.PointField(null=True, blank=True) + location = models.ForeignKey(Location, on_delete=models.CASCADE, null=True, blank=True) + has_video = models.BooleanField(blank=True, default=False) + disclaimer = models.BooleanField(blank=True, default=False) + field_notes = models.ManyToManyField(FieldNote, blank=True) + books = models.ManyToManyField(Book, blank=True) + jrnl = models.ManyToManyField(Entry, blank=True) + + class Meta: + ordering = ('-pub_date',) + get_latest_by = 'pub_date' + verbose_name_plural = 'Guides' + + def __str__(self): + return self.title + + def get_absolute_url(self): + if self.post_type == 0: + return reverse('guide:guide-detail', kwargs={"slug": self.slug}) + if self.post_type == 1: + return reverse('review:review-detail', kwargs={"slug": self.slug}) + + def comment_period_open(self): + return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date + + @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 '' + + @property + def longitude(self): + '''Get the site's longitude.''' + return self.point.x + + @property + def latitude(self): + '''Get the site's latitude.''' + return self.point.y + + def save(self, *args, **kwargs): + created = self.pk is None + if not created: + md = render_images(self.body_markdown) + self.body_html = markdown_to_html(md) + self.prologue_html = markdown_to_html(self.prologue_markdown) + self.epilogue_html = markdown_to_html(self.epilogue_markdown) + self.has_video = parse_video(self.body_html) + if self.point: + try: + self.location = Location.objects.filter(geometry__contains=self.point).get() + except Location.DoesNotExist: + raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" % (settings.BASE_URL)) + if created and not self.featured_image: + self.featured_image = LuxImage.objects.latest() + old = type(self).objects.get(pk=self.pk) if self.pk else None + if old and old.featured_image != self.featured_image: # Field has changed + s = LuxImageSize.objects.get(name="featured_jrnl") + ss = LuxImageSize.objects.get(name="picwide-med") + self.featured_image.sizes.add(s) + self.featured_image.sizes.add(ss) + self.featured_image.save() + super(Guide, self).save(*args, **kwargs) + + +class GuideSitemap(Sitemap): + changefreq = "never" + priority = 1.0 + protocol = "https" + + def items(self): + return Guide.objects.filter(status=1) + + def lastmod(self, obj): + return obj.pub_date diff --git a/app/unused_apps/guides/review_urls.py b/app/unused_apps/guides/review_urls.py new file mode 100644 index 0000000..7048065 --- /dev/null +++ b/app/unused_apps/guides/review_urls.py @@ -0,0 +1,18 @@ +from django.urls import path, re_path + +from . import views + +app_name = "review" + +urlpatterns = [ + path( + r'', + views.GuideDetailView.as_view(), + name="review-detail" + ), + path( + r'.txt', + views.GuideDetailViewTXT.as_view(), + name="review-detail-txt" + ), +] diff --git a/app/unused_apps/guides/templates/guides/guide_detail.html b/app/unused_apps/guides/templates/guides/guide_detail.html new file mode 100644 index 0000000..1ef602a --- /dev/null +++ b/app/unused_apps/guides/templates/guides/guide_detail.html @@ -0,0 +1,176 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load comments %} +{%block htmlclass%}class="detail single"{%endblock%} +{% block pagetitle %}{{object.title|title|smartypants|safe}} - by Scott Gilbertson{% endblock %} + +{% block metadescription %}{% autoescape on %}{{object.meta_description|striptags|safe}}{% endautoescape %}{% endblock %} +{%block extrahead%} +{% if object.has_code %} + +{%endif %} + + + + + + + + + + + + + + + {% if object.featured_image %} + {%endif%} + +{%endblock%} + +{%block bodyid %}{% if object.get_post_type_display == 'tools' %}class="src"{% endif %}{%endblock%} + +{% block primary %} +
+
+
+

{%if object.template_name == 1 or object.template_name == 3 %}{{object.title|smartypants|safe}}{%else%}{{object.title|smartypants|safe}}{%endif%}

+

{{object.sub_title|smartypants|safe}}

+
+ {% if object.originally_published_by %}

Originally Published By: {{object.originally_published_by}}

{%endif%} + {% if object.location %}
+

{% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state_name|safe}}, U.S.{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name|safe}}{%endif%}

+ – Map +
{%endif%} + + +
+
+
+ {% if object.preamble %}
+ {{object.preamble_html|smartypants|safe}} +
{%endif%} + {{object.body_html|safe|smartypants}} +
+ {% if object.afterword_html %}
+

Afterward

+ {{object.afterword_html|smartypants|safe}} +
{%endif%} + {%if wildlife or object.field_notes.all or object.books.all %}{%endif%} +
+ + {% comment %}
+
If you enjoyed this, you should join the mailing list…
+ {% include 'mailing_list.html' %} +
{% endcomment %} +
+ {% if object.enable_comments %} +{% get_comment_count for object as comment_count %} +{%if comment_count > 0 %} +

{{comment_count}} Comment{{ comment_count|pluralize }}

+{% render_comment_list for object %} +{%endif%} +{% render_comment_form for object %} +{% else %} +

Sorry, comments have been disabled for this post.

+{%endif%} +{% endblock %} +{% block js %} + +{%endblock%} diff --git a/app/unused_apps/guides/templates/guides/guide_detail.txt b/app/unused_apps/guides/templates/guides/guide_detail.txt new file mode 100644 index 0000000..547ce79 --- /dev/null +++ b/app/unused_apps/guides/templates/guides/guide_detail.txt @@ -0,0 +1,8 @@ +{{object.title|safe}} +{% for letter in object.title %}={%endfor%} + + by Scott Gilbertson + <{{SITE_URL}}{{object.get_absolute_url}}> + {{object.pub_date|date:"l, d F Y"}} + +{{object.body_markdown|safe}} diff --git a/app/unused_apps/guides/templates/guides/guide_list.html b/app/unused_apps/guides/templates/guides/guide_list.html new file mode 100644 index 0000000..a264a11 --- /dev/null +++ b/app/unused_apps/guides/templates/guides/guide_list.html @@ -0,0 +1,40 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load html5_datetime %} +{% load pagination_tags %} +{% block pagetitle %}Guides for the Perplexed{% endblock %} +{% block metadescription %}Guides for fellow travelers: tools, tips, and tricks to make life on the road easier.{% endblock %} + +{% block primary %} +
+
+

Guides for fellow travelers

+

The less stuff you travel with the better off you will be, up to a point. But where is that point? What's enough? What's too much? That point is what I'm trying to discover here.

+

What do you really need? What's worth having? What's not?

+

Topics include {% for topic in topic_list %}{{topic}}, {% endfor %}travel, cooking, photography, writing, simplicity, and once, coffee.

+
+

Guides

+ {% autopaginate object_list 30 %} + +
+{%endblock%} diff --git a/app/unused_apps/guides/urls.py b/app/unused_apps/guides/urls.py new file mode 100644 index 0000000..c91a5b5 --- /dev/null +++ b/app/unused_apps/guides/urls.py @@ -0,0 +1,34 @@ +from django.urls import path, re_path + +from . import views + +app_name = "guides" + +urlpatterns = [ + path( + r'', + views.GuideListView.as_view(), + {'page': 1}, + name="list" + ), + path( + r'/', + views.GuideListView.as_view(), + name="list" + ), + path( + r'/', + views.GuideDetailView.as_view(), + name="detail" + ), + path( + r'/', + views.GuideDetailViewTXT.as_view(), + name="detail-txt" + ), + path( + r'', + views.GuideCatListView.as_view(), + name="list-cat" + ), +] diff --git a/app/unused_apps/guides/views.py b/app/unused_apps/guides/views.py new file mode 100644 index 0000000..01dc974 --- /dev/null +++ b/app/unused_apps/guides/views.py @@ -0,0 +1,62 @@ +from django.views.generic import ListView +from django.views.generic.detail import DetailView +from django.contrib.syndication.views import Feed + +from utils.views import PaginatedListView + +from .models import Guide + + +class GuideListView(PaginatedListView): + model = Guide + + def get_queryset(self, **kwargs): + qs = Guide.objects.filter(status=1) + return qs + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(GuideListView, self).get_context_data(**kwargs) + context['topic_list'] = Guide.tags.all() + return context + + +class GuideCatListView(GuideListView): + model = Guide + + def get_queryset(self, **kwargs): + cat = Category.objects.get(slug=self.kwargs['slug']) + qs = Guide.objects.filter(status=1, tags=cat) + return qs + +class GuideDetailView(DetailView): + model = Guide + + +class GuideDetailViewTXT(GuideDetailView): + template_name = "essays/entry_detail.txt" + + +''' +class TopicListView(ListView): + template_name = 'archives/src_home.html' + + def queryset(self): + return Post.objects.filter(topics__slug=self.kwargs['slug']) + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(TopicListView, self).get_context_data(**kwargs) + context['topic'] = Topic.objects.get(slug__exact=self.kwargs['slug']) + return context + + +class SrcRSSFeedView(Feed): + title = "luxagraf:src Code and Technology" + link = "/src/" + description = "Latest postings to luxagraf.net/src" + description_template = 'feeds/blog_description.html' + + def items(self): + return Post.objects.filter(status__exact=1).order_by('-pub_date')[:10] +''' diff --git a/app/unused_apps/sketches/migrations/0003_auto_20190303_1057.py b/app/unused_apps/sketches/migrations/0003_auto_20190303_1057.py new file mode 100644 index 0000000..87cfbf1 --- /dev/null +++ b/app/unused_apps/sketches/migrations/0003_auto_20190303_1057.py @@ -0,0 +1,24 @@ +# Generated by Django 2.1.7 on 2019-03-03 10:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sketches', '0002_auto_20180208_0743'), + ] + + operations = [ + migrations.AddField( + model_name='sketch', + name='subtitle', + field=models.CharField(blank=True, max_length=250), + ), + migrations.AlterField( + model_name='sketch', + name='title', + field=models.CharField(blank=True, default='', max_length=250), + preserve_default=False, + ), + ] diff --git a/config/base_urls.py b/config/base_urls.py index 11c1087..5820bef 100644 --- a/config/base_urls.py +++ b/config/base_urls.py @@ -13,7 +13,7 @@ from locations.models import WritingbyCountrySitemap from photos.models import PhotoGallerySitemap from src.models import SrcSitemap from books.models import BookSitemap -from essays.models import EssaySitemap +from posts.models import PostSitemap from projects.models.base import ProjectSitemap import builder.views import utils.views @@ -25,10 +25,10 @@ admin.autodiscover() sitemaps = { 'blog': BlogSitemap, + 'posts': PostSitemap, 'notes': FieldNoteSitemap, 'writingbyloc': WritingbyCountrySitemap, 'src': SrcSitemap, - 'essays': EssaySitemap, 'books': BookSitemap, } @@ -44,6 +44,7 @@ urlpatterns = [ path(r'newsletter/', include('lttr.urls')), path(r'jrnl/', include('jrnl.urls')), path(r'projects/', include('projects.urls')), + path(r'topics/', include('taxonomy.urls')), path(r'locations/', include('locations.urls')), path(r'expenses/', include('expenses.urls', namespace='expenses')), path(r'photos/', include('photos.urls')), diff --git a/design/sass/_archives.scss b/design/sass/_archives.scss index db232ee..8c9e328 100644 --- a/design/sass/_archives.scss +++ b/design/sass/_archives.scss @@ -44,6 +44,19 @@ } } +.archive-list .essay-intro { + h2 { + @include fontsize(38); + } + h3 { + font-weight: normal; + font-family: $fancy_serif; + @include fontsize(22); + line-height: 1.3; + font-style: italic; + margin: .25rem 0 .5rem; + } +} // container for archive grid items .archive-grid { diff --git a/design/sass/_comments.scss b/design/sass/_comments.scss index f5a533e..a7c68be 100644 --- a/design/sass/_comments.scss +++ b/design/sass/_comments.scss @@ -15,6 +15,7 @@ .comment { margin-top: 2.5em; margin-bottom: 2.5em; + padding-top: 3rem; &:first-child { margin-top: none; } @@ -37,6 +38,15 @@ .comment--body { margin-bottom: 3em; @include fontsize(22); + hr { + width: 20%; + overflow: visible; + padding: 0; + border: none; + border-top: 2px solid #d4d4d4; + color: #efefef; + background: none; + } } .who { @include fancy_sans; diff --git a/design/sass/_details.scss b/design/sass/_details.scss index b84e680..f23ae7c 100644 --- a/design/sass/_details.scss +++ b/design/sass/_details.scss @@ -212,6 +212,20 @@ h4.post-source { padding-right: 8px; padding-left: 3px; } +//### GUIDE STUFF ### +.detail .product-link { + margin: 2rem 0 1rem 0; + letter-spacing: -0.02rem; +} +.detail .post-guide { + h3 { + @include fontsize(24); + margin: 4rem 0 .25rem 0; + & + p { + margin-top: 0; + } + } +} //### PAGE NAVIGATION ### .nav-wrapper { @include constrain_narrow(); diff --git a/design/sass/_fonts.scss b/design/sass/_fonts.scss index 9bdc94c..e456b8d 100644 --- a/design/sass/_fonts.scss +++ b/design/sass/_fonts.scss @@ -29,4 +29,11 @@ font-weight: 400; font-style: normal; } +@font-face { + font-family: 'mffnbweb'; + src: url('/media/fonts/ffmn.woff2') format('woff2'); + src: url('/media/fonts/ffmn.woff') format('woff'); + font-weight: 700; + font-style: normal; +} diff --git a/design/sass/_global.scss b/design/sass/_global.scss index 0d81bba..5030dbf 100644 --- a/design/sass/_global.scss +++ b/design/sass/_global.scss @@ -151,7 +151,7 @@ h2 { } } h3 { - @include fancy_sans; + font-family: $fancy_sans; @include fontsize(24); text-align: left; @include breakpoint(gamma){ diff --git a/design/sass/_mixins.scss b/design/sass/_mixins.scss index 8c936eb..9ccd750 100644 --- a/design/sass/_mixins.scss +++ b/design/sass/_mixins.scss @@ -6,6 +6,8 @@ $link_color: #b53a04; $headline_font_serif: mffweb, Georgia, 'Times New Roman', serif; $fancy_serif: mffweb, Georgia, 'Times New Roman', serif; +$fancy_sans: mffnweb, Helvetica, sans-serif; + $body_p_font: normal 100% / 1.5 Georgia, Cambria, "Times New Roman", Times, serif; $body_font_color: $brown; @@ -55,8 +57,8 @@ $max_width: 1440px; font-family: mffnweb, Helvetica, sans-serif; } @mixin fancy-sans-bold { - font-family: Helvetica, sans-serif; - font-weight: 600; + font-family: mffnbweb, Helvetica, sans-serif; + font-weight: 700; } @mixin fancy-serif { font-family: Georgia, Palatino, serif; diff --git a/design/templates/base.html b/design/templates/base.html index a95fb26..fbbd0ae 100644 --- a/design/templates/base.html +++ b/design/templates/base.html @@ -69,7 +69,7 @@

© 2003-{% now "Y" %} - Scott Gilbertson, except photos, which are licensed under the Creative Commons (details). + Scott Gilbertson.

-- cgit v1.2.3-70-g09d2