From b66d000ee469539ce7aea557b612c0444177e36d Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sat, 15 Aug 2020 11:58:34 -0400 Subject: archived old unused apps and migrated fieldnotes to posts --- app/src/__init__.py | 0 app/src/admin.py | 62 ---------- app/src/build.py | 62 ---------- app/src/migrations/0001_initial.py | 76 ------------ app/src/migrations/0002_auto_20160329_2107.py | 19 --- app/src/migrations/0003_auto_20180707_0958.py | 17 --- app/src/migrations/0004_auto_20191007_0905.py | 17 --- app/src/migrations/__init__.py | 0 app/src/models.py | 171 -------------------------- app/src/templates/src/srcpost_detail.html | 112 ----------------- app/src/templates/src/srcpost_list.html | 30 ----- app/src/templates/src/topic_list.html | 35 ------ app/src/urls.py | 49 -------- app/src/views.py | 89 -------------- 14 files changed, 739 deletions(-) delete mode 100644 app/src/__init__.py delete mode 100644 app/src/admin.py delete mode 100644 app/src/build.py delete mode 100644 app/src/migrations/0001_initial.py delete mode 100644 app/src/migrations/0002_auto_20160329_2107.py delete mode 100644 app/src/migrations/0003_auto_20180707_0958.py delete mode 100644 app/src/migrations/0004_auto_20191007_0905.py delete mode 100644 app/src/migrations/__init__.py delete mode 100644 app/src/models.py delete mode 100644 app/src/templates/src/srcpost_detail.html delete mode 100644 app/src/templates/src/srcpost_list.html delete mode 100644 app/src/templates/src/topic_list.html delete mode 100644 app/src/urls.py delete mode 100644 app/src/views.py (limited to 'app/src') diff --git a/app/src/__init__.py b/app/src/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/src/admin.py b/app/src/admin.py deleted file mode 100644 index f354b15..0000000 --- a/app/src/admin.py +++ /dev/null @@ -1,62 +0,0 @@ -from django.contrib import admin -from .models import Topic, SrcPost, Book -from utils.widgets import LGEntryForm - - -@admin.register(Topic) -class TopicAdmin(admin.ModelAdmin): - prepopulated_fields = {"slug": ('name',), "pluralized_name": ('name',)} - - -@admin.register(Book) -class BookAdmin(admin.ModelAdmin): - prepopulated_fields = {"slug": ('title', )} - list_display = ('title', 'pub_date', 'status') - fieldsets = ( - ('Entry', { - 'fields': ( - 'title', - 'body_markdown', - 'image', - ('pub_date', 'status'), - ('price', 'price_sale'), - 'meta_description', - ('slug', 'template_name', 'pages'), - ), - 'classes': ( - 'show', - 'extrapretty', - 'wide' - ) - } - ), - ) - - -@admin.register(SrcPost) -class PostAdmin(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', - 'body_markdown', - ('pub_date', 'status'), - 'topics', - 'meta_description', - ('slug', 'enable_comments', 'has_code', 'template_name'), - ), - 'classes': ( - 'show', - 'extrapretty', - 'wide' - ) - } - ), - ) - - class Media: - js = ('image-loader.js', 'next-prev-links.js') diff --git a/app/src/build.py b/app/src/build.py deleted file mode 100644 index a16bdaf..0000000 --- a/app/src/build.py +++ /dev/null @@ -1,62 +0,0 @@ -import os -from builder.base import BuildNew -from django.urls import reverse -from . import models - - -class BuildSrc(BuildNew): - - def build(self): - self.build_list_view( - base_path=reverse("src:list"), - paginate_by=99999 - ) - self.build_list_view( - base_path=reverse("src:list_books"), - paginate_by=99999 - ) - self.build_detail_view() - # These are the unique classes for this model: - # self.build_books_view() - self.build_topic_view() - self.build_feed("src:feed") - - def build_topic_view(self): - for topic in models.Topic.objects.all(): - ctype = ContentType.objects.get(app_label='posts', model='post') - for cat in Category.objects.all(): - - url = reverse("src:list_topics", kwargs={'slug': topic.slug, }) - path, slug = os.path.split(url) - response = self.client.get(url, HTTP_HOST='127.0.0.1') - self.write_file('%s/' % path, response.content, filename=slug) - - def build_books_view(self): - for obj in models.Book.objects.all(): - url = reverse("src:detail_book", kwargs={'slug': obj.slug, }) - path, slug = os.path.split(url) - response = self.client.get(url, HTTP_HOST='127.0.0.1') - self.write_file('%s/' % path, response.content, filename=slug) - - -def builder(): - j = BuildSrc("src", "srcpost") - j.build() - - -""" - - - - - def build_books(self): - path = 'src/books/' - c = Context({ - 'object_list': Book.objects.filter(status__exact=1), - 'MEDIA_URL': settings.BAKED_MEDIA_URL, - 'IMAGES_URL': settings.BAKED_IMAGES_URL - }) - t = render_to_string('archives/src_books.html', c).encode('utf-8') - self.write_file(path, t) - -""" diff --git a/app/src/migrations/0001_initial.py b/app/src/migrations/0001_initial.py deleted file mode 100644 index 1f672ee..0000000 --- a/app/src/migrations/0001_initial.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-29 21:06 -from __future__ import unicode_literals - -from django.db import migrations, models -import src.models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Book', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=200)), - ('image', models.FileField(blank=True, null=True, upload_to=src.models.get_upload_path)), - ('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)), - ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0)), - ('price', models.FloatField()), - ('price_sale', models.FloatField()), - ('meta_description', models.CharField(blank=True, max_length=256, null=True)), - ('pages', models.DecimalField(blank=True, decimal_places=0, max_digits=3, null=True)), - ('template_name', models.CharField(choices=[('details/src_book.html', 'Default'), ('details/src_book_2.html', 'Book Two')], default='details/src_book.html', max_length=200)), - ], - options={ - 'get_latest_by': 'pub_date', - 'ordering': ('-pub_date',), - }, - ), - migrations.CreateModel( - name='Entry', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=200)), - ('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)), - ('template_name', models.IntegerField(choices=[(0, 'default')], default=0)), - ], - options={ - 'get_latest_by': 'pub_date', - 'ordering': ('-pub_date',), - 'verbose_name_plural': 'entries', - }, - ), - migrations.CreateModel( - name='Topic', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=60)), - ('slug', models.SlugField()), - ('pluralized_name', models.CharField(max_length=60)), - ], - ), - migrations.AddField( - model_name='entry', - name='topics', - field=models.ManyToManyField(blank=True, to='src.Topic'), - ), - ] diff --git a/app/src/migrations/0002_auto_20160329_2107.py b/app/src/migrations/0002_auto_20160329_2107.py deleted file mode 100644 index 25f5e4e..0000000 --- a/app/src/migrations/0002_auto_20160329_2107.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-29 21:07 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('src', '0001_initial'), - ] - - operations = [ - migrations.RenameModel( - old_name='Entry', - new_name='Post', - ), - ] diff --git a/app/src/migrations/0003_auto_20180707_0958.py b/app/src/migrations/0003_auto_20180707_0958.py deleted file mode 100644 index f619888..0000000 --- a/app/src/migrations/0003_auto_20180707_0958.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.0.1 on 2018-07-07 09:58 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('src', '0002_auto_20160329_2107'), - ] - - operations = [ - migrations.AlterModelOptions( - name='post', - options={'get_latest_by': 'pub_date', 'ordering': ('-pub_date',), 'verbose_name_plural': 'posts'}, - ), - ] diff --git a/app/src/migrations/0004_auto_20191007_0905.py b/app/src/migrations/0004_auto_20191007_0905.py deleted file mode 100644 index 6c223a0..0000000 --- a/app/src/migrations/0004_auto_20191007_0905.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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/migrations/__init__.py b/app/src/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/src/models.py b/app/src/models.py deleted file mode 100644 index 69d85a5..0000000 --- a/app/src/models.py +++ /dev/null @@ -1,171 +0,0 @@ -import re -from django.db import models -from django.urls import reverse -from django.contrib.sitemaps import Sitemap -from django.conf import settings -import datetime -from itertools import chain - -from utils.util import parse_image, markdown_to_html - - -def render_images(s): - s = re.sub('', parse_image, s) - return s - - -class Topic(models.Model): - name = models.CharField(max_length=60) - slug = models.SlugField() - pluralized_name = models.CharField(max_length=60) - - def __str__(self): - return self.name - - def get_absolute_url(self): - return reverse('src:list_topics', kwargs={"slug": self.slug}) - - @property - def pub_date(self): - return datetime.datetime.now() - - -class SrcPost(models.Model): - title = models.CharField(max_length=200) - slug = models.SlugField(unique_for_date='pub_date') - body_html = models.TextField(blank=True) - body_markdown = models.TextField() - pub_date = models.DateTimeField('Date published') - topics = models.ManyToManyField(Topic, blank=True) - 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) - TEMPLATES = ( - (0, 'default'), - ) - template_name = models.IntegerField(choices=TEMPLATES, default=0) - - class Meta: - ordering = ('-pub_date',) - get_latest_by = 'pub_date' - verbose_name_plural = 'posts' - - def __str__(self): - return self.title - - def get_absolute_url(self): - return reverse('src: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) - super(SrcPost, self).save() - - -def get_upload_path(self, filename): - return "images/src/%s" % filename - - -class Book(models.Model): - title = models.CharField(max_length=200) - image = models.FileField(blank=True, null=True, upload_to=get_upload_path) - 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) - PUB_STATUS = ( - (0, 'Draft'), - (1, 'Published'), - ) - status = models.IntegerField(choices=PUB_STATUS, default=0) - price = models.FloatField() - price_sale = models.FloatField() - meta_description = models.CharField(max_length=256, null=True, blank=True) - pages = models.DecimalField(max_digits=3, decimal_places=0, null=True, blank=True) - DEFAULT = 'details/src_book.html' - BOOK2 = 'details/src_book_2.html' - TEMPLATES = ( - (DEFAULT, 'Default'), - (BOOK2, 'Book Two'), - ) - template_name = models.CharField( - max_length=200, - choices=TEMPLATES, - default=DEFAULT - ) - - class Meta: - ordering = ('-pub_date',) - get_latest_by = 'pub_date' - - def __str__(self): - return self.title - - def get_absolute_url(self): - return reverse('src:detail_book', kwargs={"slug": self.slug}) - - def get_image_url(self): - img = self.image.url.split('src/')[1] - return '%ssrc/%s' % (settings.IMAGES_URL, img) - - def save(self): - md = render_images(self.body_markdown) - self.body_html = markdown_to_html(md) - super(Book, self).save() - - -'''class SrcDemo(models.Model): - title = models.CharField(max_length=254) - slug = models.SlugField() - body = models.TextField(blank=True, null=True) - head = models.TextField(blank=True, null=True) - DEMO_TEMPLATES = ( - (0, 'Blank'), - (1, 'Basic_light'), - ) - template = models.IntegerField(choices=DEMO_TEMPLATES, default=0) - pub_date = models.DateTimeField('Date published', blank=True) - - class Meta: - verbose_name_plural = "Demos" - app_label = 'projects' - ordering = ('-pub_date',) - - def save(self): - if not self.id: - self.pub_date = datetime.datetime.now() - super(SrcDemo, self).save() -''' - - -class SrcSitemap(Sitemap): - changefreq = "never" - priority = 0.7 - protocol = "https" - - def items(self): - return list(chain( - SrcPost.objects.filter(status=1), - Topic.objects.all() - )) - - def lastmod(self, obj): - return obj.pub_date diff --git a/app/src/templates/src/srcpost_detail.html b/app/src/templates/src/srcpost_detail.html deleted file mode 100644 index 733f586..0000000 --- a/app/src/templates/src/srcpost_detail.html +++ /dev/null @@ -1,112 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% load comments %} -{% block pagetitle %}{{object.title|striptags}} - by Scott Gilbertson{% endblock %} -{% block metadescription %}{% autoescape on %}{{object.meta_description|striptags|safe}}{% endautoescape %}{% endblock %} -{%block extrahead%} - - - - - - - - - - - - - - -{%endblock%} - -{% block bodyid %}class="src detail single"{% endblock %} -{%block sitesubtitle %}Code Slowly{% endblock%} -{% block breadcrumbs %}{% endblock %} -{% block primary %}
-
-
-

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

-

{{object.meta_description|smartypants|safe}}

-
- {% if object.originally_published_by %}

Originally Published By: {{object.originally_published_by}}

{%endif%} - {% if object.topics.all %}

Topics: {% for topic in object.topics.all%} {{topic.name}}{%if forloop.last%}{%else%}, {%endif%}{%endfor%}

{%endif%} - - -
-
- - -
- {{object.body_html|safe|smartypants|widont}} -
-
- {% if object.slug != 'about' %} - {% with object.get_next_published as next %} - {% with object.get_previous_published as prev %} - {%endwith%}{%endwith%} - {%endif%} -
- {% if object.slug != 'about' %} - {% 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%} -{%endif%} -{% endblock %} -{% block js %} - -{% if object.has_code %} -{%endif %} -{% endblock %} diff --git a/app/src/templates/src/srcpost_list.html b/app/src/templates/src/srcpost_list.html deleted file mode 100644 index dd5d410..0000000 --- a/app/src/templates/src/srcpost_list.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% load comments %} - -{% block pagetitle %}Tutorials and tools for building great things{% endblock %} -{% block metadescription %}Tutorials and tools for building great things on the web - by Scott Gilbertson.{% endblock %} -{%block sitesubtitle %}Code Slowly{% endblock%} -{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} -{% block primary %}
-
-

Tutorials and tools for building great things on the web.

-

The indie web is an amazing democratic publishing platform unlike anything in history. The catch is, to avoid serving at the pleasure of the corporate king, you need to know how to publish. That's what these articles are here for, to help you learn how to use independent, community supported open source tools. The web won't last forever, let's build something cool while we can.

-

Topics include HTML, CSS, Django, Linux, Nginx, Python, Postgresql, free software, and, once, the evil that is Google AMP.

-

A few of the articles below were previously published in: Ars Technica, Wired, and The Register

-
-

Articles

- - - - -
-{%endblock%} diff --git a/app/src/templates/src/topic_list.html b/app/src/templates/src/topic_list.html deleted file mode 100644 index 7149823..0000000 --- a/app/src/templates/src/topic_list.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% load comments %} - -{% block pagetitle %}Tutorials and tools for building great things{% endblock %} - -{% block metadescription %}Tutorials about {{topic}} - by Scott Gilbertson.{% endblock %} -{%block sitesubtitle %}Code Slowly{% endblock%} -{% block primary %} -
-
-

Tutorials and tools for building great things on the web.

-

The indie web is an amazing democratic publishing platform unlike anything in history. The catch is, to avoid serving at the pleasure of the corporate king, you need to know how to publish. That's what these articles are here for, to help you learn how to use independent, community supported open source tools. The web won't last forever, let's build something cool while we can.

-

A few of the articles below were previously published in: Ars Technica, Wired, and The Register

-
-

Tutorials about {{topic}}

- - - - -
-{%endblock%} diff --git a/app/src/urls.py b/app/src/urls.py deleted file mode 100644 index 0ac6897..0000000 --- a/app/src/urls.py +++ /dev/null @@ -1,49 +0,0 @@ -from django.urls import path, re_path - -from . import views - -app_name = "src" - -urlpatterns = [ - path( - r'feed.xml', - views.SrcRSSFeedView(), - name="feed" - ), - path( - r'topic/', - views.TopicListView.as_view(), - name="list_topics" - ), - path( - r'books/', - views.BookDetailView.as_view(), - name='detail_book' - ), - path( - r'books/', - views.BookListView.as_view(), - name='list_books' - ), - path( - r'.txt', - views.EntryDetailViewTXT.as_view(), - name="detail-txt" - ), - path( - r'', - views.EntryDetailView.as_view(), - name="detail" - ), - re_path( - r'', - views.SrcListView.as_view(), - name="list" - ), - path( - r'', - views.SrcListView.as_view(), - {'page':1}, - name="list" - ), -] diff --git a/app/src/views.py b/app/src/views.py deleted file mode 100644 index 7540e02..0000000 --- a/app/src/views.py +++ /dev/null @@ -1,89 +0,0 @@ -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 utils.views import PaginatedListView -from .models import SrcPost, Topic, Book - - -class BookListView(ListView): - template_name = "archives/src_books.html" - - def queryset(self): - return Book.objects.filter(status__exact=1) - - -class BookDetailView(DetailView): - model = Book - - def get_template_names(self): - book = self.get_object() - return [book.template_name] - - def get_context_data(self, **kwargs): - # Call the base implementation first to get a context - context = super(BookDetailView, self).get_context_data(**kwargs) - book = self.get_object() - if book.price_sale < book.price: - price = book.price_sale - else: - price = book.price - #paypal_dict = { - # "business": settings.PAYPAL_RECEIVER_EMAIL, - # "amount": price, - # "item_name": book.title, - # "invoice": "unique-invoice-id", - # "notify_url": "https://luxagraf.net/src/paypal/" + reverse('src:paypal-ipn'), - # "return_url": "https://luxagraf.net/src/thank-you", - # "cancel_return": "https://luxagraf.net/src/books/", - #} - #context['paypal_form'] = PayPalPaymentsForm(initial=paypal_dict) - return context - - -class SrcListView(PaginatedListView): - model = SrcPost - - def get_queryset(self): - return SrcPost.objects.filter(status__exact=1) - - def get_context_data(self, **kwargs): - # Call the base implementation first to get a context - context = super(SrcListView, self).get_context_data(**kwargs) - context['topics'] = Topic.objects.all() - return context - - -class EntryDetailView(DetailView): - model = SrcPost - slug_field = "slug" - - -class EntryDetailViewTXT(EntryDetailView): - template_name = "jrnl/entry_detail.txt" - - -class TopicListView(ListView): - template_name = 'src/topic_list.html' - - def get_queryset(self): - return SrcPost.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 SrcPost.objects.filter(status__exact=1).order_by('-pub_date')[:10] -- cgit v1.2.3