diff options
Diffstat (limited to 'app/essays')
-rw-r--r-- | app/essays/__init__.py | 0 | ||||
-rw-r--r-- | app/essays/admin.py | 47 | ||||
-rw-r--r-- | app/essays/build.py | 22 | ||||
-rw-r--r-- | app/essays/migrations/0001_initial.py | 49 | ||||
-rw-r--r-- | app/essays/migrations/0002_auto_20190204_1541.py | 23 | ||||
-rw-r--r-- | app/essays/migrations/0003_essay_afterword_html.py | 18 | ||||
-rw-r--r-- | app/essays/migrations/0004_auto_20190205_0830.py | 27 | ||||
-rw-r--r-- | app/essays/migrations/0005_auto_20190208_0946.py | 25 | ||||
-rw-r--r-- | app/essays/migrations/0006_auto_20190303_1625.py | 18 | ||||
-rw-r--r-- | app/essays/migrations/0006_remove_essay_has_video.py | 17 | ||||
-rw-r--r-- | app/essays/migrations/0007_auto_20190414_1455.py | 18 | ||||
-rw-r--r-- | app/essays/migrations/0007_essay_has_video.py | 18 | ||||
-rw-r--r-- | app/essays/migrations/0008_merge_20190303_1638.py | 14 | ||||
-rw-r--r-- | app/essays/migrations/0009_merge_20190414_1500.py | 14 | ||||
-rw-r--r-- | app/essays/migrations/0010_essay_field_notes.py | 19 | ||||
-rw-r--r-- | app/essays/migrations/__init__.py | 0 | ||||
-rw-r--r-- | app/essays/models.py | 91 | ||||
-rw-r--r-- | app/essays/urls.py | 28 | ||||
-rw-r--r-- | app/essays/views.py | 47 |
19 files changed, 0 insertions, 495 deletions
diff --git a/app/essays/__init__.py b/app/essays/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/app/essays/__init__.py +++ /dev/null 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 --- a/app/essays/migrations/__init__.py +++ /dev/null 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/<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/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] -''' |