summaryrefslogtreecommitdiff
path: root/bak/unused_apps/essays
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
committerluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
commit9a620cf42bf1fe6977e378bd834b41ff4a593dde (patch)
treecf41a0582681cecaf88a30bfe409f9c2be57972a /bak/unused_apps/essays
parent6e5897117124cd60ae81efb1574c6347f48e60e5 (diff)
main: removed some apps I wasn't using and added bak to git to preserve
a copy of old apps
Diffstat (limited to 'bak/unused_apps/essays')
-rw-r--r--bak/unused_apps/essays/__init__.py0
-rw-r--r--bak/unused_apps/essays/admin.py47
-rw-r--r--bak/unused_apps/essays/build.py22
-rw-r--r--bak/unused_apps/essays/migrations/0001_initial.py49
-rw-r--r--bak/unused_apps/essays/migrations/0002_auto_20190204_1541.py23
-rw-r--r--bak/unused_apps/essays/migrations/0003_essay_afterword_html.py18
-rw-r--r--bak/unused_apps/essays/migrations/0004_auto_20190205_0830.py27
-rw-r--r--bak/unused_apps/essays/migrations/0005_auto_20190208_0946.py25
-rw-r--r--bak/unused_apps/essays/migrations/0006_auto_20190303_1625.py18
-rw-r--r--bak/unused_apps/essays/migrations/0006_remove_essay_has_video.py17
-rw-r--r--bak/unused_apps/essays/migrations/0007_auto_20190414_1455.py18
-rw-r--r--bak/unused_apps/essays/migrations/0007_essay_has_video.py18
-rw-r--r--bak/unused_apps/essays/migrations/0008_merge_20190303_1638.py14
-rw-r--r--bak/unused_apps/essays/migrations/0009_merge_20190414_1500.py14
-rw-r--r--bak/unused_apps/essays/migrations/0010_essay_field_notes.py19
-rw-r--r--bak/unused_apps/essays/migrations/__init__.py0
-rw-r--r--bak/unused_apps/essays/models.py91
-rw-r--r--bak/unused_apps/essays/urls.py28
-rw-r--r--bak/unused_apps/essays/views.py47
19 files changed, 495 insertions, 0 deletions
diff --git a/bak/unused_apps/essays/__init__.py b/bak/unused_apps/essays/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bak/unused_apps/essays/__init__.py
diff --git a/bak/unused_apps/essays/admin.py b/bak/unused_apps/essays/admin.py
new file mode 100644
index 0000000..ed39ca3
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/build.py b/bak/unused_apps/essays/build.py
new file mode 100644
index 0000000..392e991
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0001_initial.py b/bak/unused_apps/essays/migrations/0001_initial.py
new file mode 100644
index 0000000..7b7ea62
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0002_auto_20190204_1541.py b/bak/unused_apps/essays/migrations/0002_auto_20190204_1541.py
new file mode 100644
index 0000000..f4e6744
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0003_essay_afterword_html.py b/bak/unused_apps/essays/migrations/0003_essay_afterword_html.py
new file mode 100644
index 0000000..5f8301b
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0004_auto_20190205_0830.py b/bak/unused_apps/essays/migrations/0004_auto_20190205_0830.py
new file mode 100644
index 0000000..65e2e5d
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0005_auto_20190208_0946.py b/bak/unused_apps/essays/migrations/0005_auto_20190208_0946.py
new file mode 100644
index 0000000..5b68bb4
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0006_auto_20190303_1625.py b/bak/unused_apps/essays/migrations/0006_auto_20190303_1625.py
new file mode 100644
index 0000000..dde70fd
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0006_remove_essay_has_video.py b/bak/unused_apps/essays/migrations/0006_remove_essay_has_video.py
new file mode 100644
index 0000000..0842d8b
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0007_auto_20190414_1455.py b/bak/unused_apps/essays/migrations/0007_auto_20190414_1455.py
new file mode 100644
index 0000000..a5242cb
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0007_essay_has_video.py b/bak/unused_apps/essays/migrations/0007_essay_has_video.py
new file mode 100644
index 0000000..0057e95
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0008_merge_20190303_1638.py b/bak/unused_apps/essays/migrations/0008_merge_20190303_1638.py
new file mode 100644
index 0000000..7c155d8
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0009_merge_20190414_1500.py b/bak/unused_apps/essays/migrations/0009_merge_20190414_1500.py
new file mode 100644
index 0000000..83a8323
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/0010_essay_field_notes.py b/bak/unused_apps/essays/migrations/0010_essay_field_notes.py
new file mode 100644
index 0000000..ca15b38
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/migrations/__init__.py b/bak/unused_apps/essays/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bak/unused_apps/essays/migrations/__init__.py
diff --git a/bak/unused_apps/essays/models.py b/bak/unused_apps/essays/models.py
new file mode 100644
index 0000000..c75f72d
--- /dev/null
+++ b/bak/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/bak/unused_apps/essays/urls.py b/bak/unused_apps/essays/urls.py
new file mode 100644
index 0000000..8216f06
--- /dev/null
+++ b/bak/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/<str:slug>',
+ # views.TopicListView.as_view(),
+ # name="list_topics"
+ #),
+ path(
+ r'<str:slug>',
+ views.EntryDetailView.as_view(),
+ name="detail"
+ ),
+ path(
+ r'<str:slug>',
+ views.EntryDetailViewTXT.as_view(),
+ name="detail-txt"
+ ),
+ path(
+ r'',
+ views.EssayListView.as_view(),
+ name="list",
+ ),
+]
diff --git a/bak/unused_apps/essays/views.py b/bak/unused_apps/essays/views.py
new file mode 100644
index 0000000..f8c68c7
--- /dev/null
+++ b/bak/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]
+'''