diff options
author | luxagraf <sng@luxagraf.net> | 2020-12-02 12:41:14 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-12-02 12:41:14 -0500 |
commit | 8b2b5dec69a1d5d3c9e19c5eda48d1d6f706f9b4 (patch) | |
tree | 8ef75a6df028cdf04b2ad603cfd92a587049b15b | |
parent | d4e55690d3293f375cb207693e9b02b39b4a940e (diff) |
ready to get rid of photos model for media model
28 files changed, 49 insertions, 65 deletions
@@ -8,14 +8,35 @@ Monthly $8/Yearly $100/lifetime $900 free digital book that year, along with supplemental stories access to members-only mailing list live stream Q&As +free audio books Monthly $14/Yearly $120/lifetime $1400 real-time access chances to hang out when I am near your town +## Lulu and birdie: + +blog about good kids books +blog about pirate research +blog about activities for kids +podcast on famous pirates +what it's like to sail in a wood ship +why pirates + + - Members: + free ebooks + extra members only lulu and birdie stories and outtakes + t-shirts + artwork + + + ## Notes: Fix out of sequence postgres tables: -ALTER TABLE lttr_subscriber ALTER COLUMN id SET DEFAULT nextval('lttr_subscriber_id_seq'::regclass); -SELECT setval('lttr_subscriber_id_seq', (SELECT MAX(id) FROM lttr_subscriber)+1) +ALTER TABLE media_luximagesize ALTER COLUMN id SET DEFAULT nextval('media_luximagesize_id_seq'::regclass); +SELECT setval('media_luximagesize_id_seq', (SELECT MAX(id) FROM media_luximagesize)+1); + +ALTER TABLE media_luximage_sizes ALTER COLUMN id SET DEFAULT nextval('media_luximage_sizes_id_seq'::regclass); +SELECT setval('media_luximage_sizes_id_seq', (SELECT MAX(id) FROM media_luximage_sizes)+1); diff --git a/app/books/models.py b/app/books/models.py index eafa9be..a9d7cad 100644 --- a/app/books/models.py +++ b/app/books/models.py @@ -10,7 +10,7 @@ from django.utils.html import format_html from django.conf import settings from django.template.defaultfilters import slugify -from photos.utils import resize_image +from media.utils import resize_image from utils.util import markdown_to_html diff --git a/app/builder/views.py b/app/builder/views.py index 5988e1f..b50bcb3 100644 --- a/app/builder/views.py +++ b/app/builder/views.py @@ -5,10 +5,7 @@ from django.template import RequestContext from resume.build import pub_builder, resume_builder from books.build import builder as book_builder from sightings.build import builder as sightings_builder -from photos.build import builder as photo_builder -#from notes.build import builder as notes_builder from pages.build import BuildPages, BuildHome -from photos.build import dailybuilder from posts.build import BuildJrnl, BuildFieldNotes, BuildSrc, BuildGuide from lttr.build import lttr_builder @@ -50,12 +47,6 @@ def do_build(request): elif section == 'buildsightings': context = {'message': 'Writing Sightings Pages to Disk'} sightings_builder() - elif section == 'luxphotos': - context = {'message': 'Writing galleries to Disk'} - photo_builder() - elif section == 'figments': - context = {'message': 'Writing figments to Disk'} - figments_builder() elif section == 'resume': context = {'message': 'Writing Resume to Disk'} resume_builder() @@ -65,9 +56,6 @@ def do_build(request): elif section == 'map': context = {'message': 'Writing Map to Disk'} map_builder() - elif section == 'dailyphotos': - context = {'message': 'Writing daily photo pages to Disk'} - dailybuilder() elif section == 'discursivepages': context = {'message': 'Writing Discursive Meditation Pages to Disk'} BuildPages("pages", "page", 'discursivemeditation.com').build() diff --git a/app/locations/migrations/0007_campsite.py b/app/locations/migrations/0007_campsite.py index 116b5ed..a6671e6 100644 --- a/app/locations/migrations/0007_campsite.py +++ b/app/locations/migrations/0007_campsite.py @@ -9,7 +9,6 @@ import django.utils.timezone class Migration(migrations.Migration): dependencies = [ - ('photos', '0018_auto_20161130_1218'), ('locations', '0006_auto_20180629_1739'), ] @@ -26,7 +25,7 @@ class Migration(migrations.Migration): ('campsite_we_wish_we_had', models.IntegerField(blank=True, null=True)), ('body_markdown', models.TextField(blank=True, null=True)), ('body_html', models.TextField(blank=True, null=True)), - ('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage')), + ('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.LuxImage')), ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), ], options={ diff --git a/app/locations/models.py b/app/locations/models.py index dfd8f27..e27e6cc 100644 --- a/app/locations/models.py +++ b/app/locations/models.py @@ -287,7 +287,7 @@ class Campsite(models.Model): campsite_we_wish_we_had = models.IntegerField(blank=True, null=True) body_markdown = models.TextField(blank=True, null=True) body_html = models.TextField(blank=True, null=True) - image = models.ForeignKey("photos.LuxImage", on_delete=models.CASCADE, null=True, blank=True) + image = models.ForeignKey("media.LuxImage", on_delete=models.CASCADE, null=True, blank=True) class Meta: ordering = ('-date_arrived',) diff --git a/app/lttr/migrations/0005_auto_20200205_1606.py b/app/lttr/migrations/0005_auto_20200205_1606.py index 0be644e..e3415bb 100644 --- a/app/lttr/migrations/0005_auto_20200205_1606.py +++ b/app/lttr/migrations/0005_auto_20200205_1606.py @@ -7,7 +7,6 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('photos', '0019_auto_20190704_0903'), ('lttr', '0004_auto_20190212_1529'), ] @@ -26,6 +25,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='newslettermailing', name='featured_image', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.LuxImage'), ), ] diff --git a/app/lttr/models.py b/app/lttr/models.py index f702478..bce6b06 100644 --- a/app/lttr/models.py +++ b/app/lttr/models.py @@ -19,7 +19,7 @@ from taggit.managers import TaggableManager from utils.util import render_images, parse_video, markdown_to_html from taxonomy.models import TaggedItems -from photos.models import LuxImage, LuxImageSize +from media.models import LuxImage, LuxImageSize from books.models import Book diff --git a/app/media/models.py b/app/media/models.py index fb44c9e..883d4df 100644 --- a/app/media/models.py +++ b/app/media/models.py @@ -15,7 +15,6 @@ from django.utils.functional import cached_property from django.urls import reverse from django.apps import apps from django.utils.html import format_html -from django.utils.text import slugify from django.conf import settings from django import forms diff --git a/app/pages/migrations/0007_homepage.py b/app/pages/migrations/0007_homepage.py index c11aae9..80682e2 100644 --- a/app/pages/migrations/0007_homepage.py +++ b/app/pages/migrations/0007_homepage.py @@ -8,7 +8,6 @@ class Migration(migrations.Migration): dependencies = [ ('posts', '0015_post_old_image'), - ('photos', '0019_auto_20190704_0903'), ('pages', '0006_page_enable_comments'), ] @@ -21,7 +20,7 @@ class Migration(migrations.Migration): ('tag_line', models.CharField(max_length=200, null=True)), ('template_name', models.CharField(help_text='full path', max_length=200)), ('featured', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='banner', to='posts.post')), - ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.luximage')), + ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.luximage')), ('popular', models.ManyToManyField(related_name='popular', to='posts.Post')), ], ), diff --git a/app/pages/migrations/0008_auto_20201114_0934.py b/app/pages/migrations/0008_auto_20201114_0934.py index e8465a6..b24f46c 100644 --- a/app/pages/migrations/0008_auto_20201114_0934.py +++ b/app/pages/migrations/0008_auto_20201114_0934.py @@ -7,7 +7,6 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('photos', '0019_auto_20190704_0903'), ('pages', '0007_homepage'), ] @@ -15,7 +14,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='homepage', name='featured_image', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='photos.luximage'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='media.luximage'), ), migrations.AlterField( model_name='homepage', diff --git a/app/pages/migrations/0010_page_featured_image.py b/app/pages/migrations/0010_page_featured_image.py index 931403f..d5fc5e1 100644 --- a/app/pages/migrations/0010_page_featured_image.py +++ b/app/pages/migrations/0010_page_featured_image.py @@ -7,7 +7,6 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('photos', '0019_auto_20190704_0903'), ('pages', '0009_page_site'), ] @@ -15,6 +14,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='page', name='featured_image', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.luximage'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.luximage'), ), ] diff --git a/app/pages/models.py b/app/pages/models.py index 0c27cee..7cf90ba 100644 --- a/app/pages/models.py +++ b/app/pages/models.py @@ -3,7 +3,7 @@ from django.db import models from django.contrib.sitemaps import Sitemap from django.contrib.sites.models import Site -from photos.models import LuxImage +from media.models import LuxImage from posts.models import Post from utils.util import markdown_to_html, render_images diff --git a/app/posts/admin.py b/app/posts/admin.py index 9031dd5..7819ac5 100644 --- a/app/posts/admin.py +++ b/app/posts/admin.py @@ -6,8 +6,7 @@ from django.contrib.contenttypes.admin import GenericStackedInline from utils.widgets import AdminImageWidget, LGEntryForm from .models import Post -from photos.forms import GalleryForm -from photos.models import LuxImage +from media.models import LuxImage from utils.util import get_latlon diff --git a/app/posts/migrations/0001_initial.py b/app/posts/migrations/0001_initial.py index 3c36ee9..1c878b7 100644 --- a/app/posts/migrations/0001_initial.py +++ b/app/posts/migrations/0001_initial.py @@ -15,7 +15,6 @@ class Migration(migrations.Migration): ('normalize', '__first__'), ('taxonomy', '0001_initial'), ('locations', '0018_auto_20190414_2124'), - ('photos', '0019_auto_20190704_0903'), ] operations = [ @@ -47,7 +46,7 @@ class Migration(migrations.Migration): ('originally_published_by_url', models.CharField(blank=True, max_length=400)), ('books', models.ManyToManyField(blank=True, to='books.Book')), ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='taxonomy.Category')), - ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage')), + ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.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')), diff --git a/app/posts/migrations/0003_auto_20190918_1230.py b/app/posts/migrations/0003_auto_20190918_1230.py index d7c89a8..04fabb0 100644 --- a/app/posts/migrations/0003_auto_20190918_1230.py +++ b/app/posts/migrations/0003_auto_20190918_1230.py @@ -24,7 +24,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='post', name='featured_image', - field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='media.LuxImage'), ), migrations.AlterField( model_name='post', diff --git a/app/posts/migrations/0004_auto_20190918_1241.py b/app/posts/migrations/0004_auto_20190918_1241.py index da829ad..726446c 100644 --- a/app/posts/migrations/0004_auto_20190918_1241.py +++ b/app/posts/migrations/0004_auto_20190918_1241.py @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='post', name='featured_image', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.LuxImage'), ), ] diff --git a/app/posts/models.py b/app/posts/models.py index 25dfe10..b64dc53 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -25,7 +25,7 @@ from django_comments.moderation import CommentModerator, moderator from taggit.managers import TaggableManager from normalize.models import RelatedPost -from photos.models import LuxImage, LuxImageSize +from media.models import LuxImage, LuxImageSize from locations.models import Location from books.models import Book #from fieldnotes.models import FieldNote @@ -119,7 +119,7 @@ class Post(models.Model): return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date def get_featured_image_thumb(self): - return self.featured_image.get_image_by_size("tn") + return self.featured_image.get_image_url_by_size("thumbnail") def get_content_type(self): return ContentType.objects.get(app_label="posts", model="post") diff --git a/app/posts/templates/posts/jrnl_detail.html b/app/posts/templates/posts/jrnl_detail.html index 8a75f25..9480732 100644 --- a/app/posts/templates/posts/jrnl_detail.html +++ b/app/posts/templates/posts/jrnl_detail.html @@ -126,10 +126,6 @@ class="detail {%if t == 1 or t == 3 or t == 5 %}double{%else%}single{%endif%}{%i <div class="post-image post-mini-image"> {% if object.featured_image %} {% include "lib/img_archive.html" with image=object.featured_image nolightbox=True %} - {% elif object.image %} - {% include "lib/img_archive.html" with image=object.image nolightbox=True %} - {% else %} - <img src="{{object.get_image_url}}" alt="{{ object.title }}" class="u-photo post-image" itemprop="image" />{%endif%} </div> <h4 class="p-name entry-title post-title" itemprop="headline">{% if object.title %}{{object.title|safe|smartypants|widont}}{% else %}{{object.common_name}}{%endif%}</h4> <p class="p-author author hide" itemprop="author"><span class="byline-author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Scott Gilbertson</span></span></p> diff --git a/app/products/migrations/0005_product_featured_image.py b/app/products/migrations/0005_product_featured_image.py index 91e37b0..032bbfa 100644 --- a/app/products/migrations/0005_product_featured_image.py +++ b/app/products/migrations/0005_product_featured_image.py @@ -7,7 +7,6 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('photos', '0019_auto_20190704_0903'), ('products', '0004_auto_20191109_0849'), ] @@ -15,6 +14,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='product', name='featured_image', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.LuxImage'), ), ] diff --git a/app/products/models.py b/app/products/models.py index 375c0cb..4b7dbec 100644 --- a/app/products/models.py +++ b/app/products/models.py @@ -10,8 +10,8 @@ from django.utils.html import format_html from django.conf import settings from django.template.defaultfilters import slugify -from photos.models import PhotoGallery, LuxImage, LuxImageSize -from photos.utils import resize_image +from media.models import LuxImage, LuxImageSize +from media.utils import resize_image from utils.util import render_images, render_products, parse_video, markdown_to_html diff --git a/app/sightings/admin.py b/app/sightings/admin.py index f6ec2af..0505ac8 100644 --- a/app/sightings/admin.py +++ b/app/sightings/admin.py @@ -3,20 +3,10 @@ from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin from .models import APClass, AP, Sighting, FieldNote -from photos.forms import GalleryForm from utils.util import get_latlon from utils.widgets import CustomSelectMultiple, LGEntryForm from django.contrib.admin.options import FORMFIELD_FOR_DBFIELD_DEFAULTS -class GalleryFormPlus(GalleryForm): - def __init__(self, *args, **kwargs): - super(GalleryFormPlus, self).__init__(*args, **kwargs) - self.base_fields['seen_by'].widget = CustomSelectMultiple() - - class Meta: - model = Sighting - fields = '__all__' - @admin.register(APClass) class APClassAdmin(admin.ModelAdmin): diff --git a/app/sightings/migrations/0001_initial.py b/app/sightings/migrations/0001_initial.py index 4c25926..f1f0c07 100644 --- a/app/sightings/migrations/0001_initial.py +++ b/app/sightings/migrations/0001_initial.py @@ -14,7 +14,6 @@ class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('photos', '0018_auto_20161130_1218'), ('locations', '0002_checkin'), ] diff --git a/app/sightings/migrations/0005_auto_20180516_1759.py b/app/sightings/migrations/0005_auto_20180516_1759.py index 301c0d9..079ce03 100644 --- a/app/sightings/migrations/0005_auto_20180516_1759.py +++ b/app/sightings/migrations/0005_auto_20180516_1759.py @@ -7,7 +7,6 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('photos', '0018_auto_20161130_1218'), ('sightings', '0004_ap_main_image'), ] @@ -19,6 +18,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ap', name='image', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='media.LuxImage'), ), ] diff --git a/app/sightings/migrations/0006_auto_20180707_0958.py b/app/sightings/migrations/0006_auto_20180707_0958.py index 9c146ed..6bdab4b 100644 --- a/app/sightings/migrations/0006_auto_20180707_0958.py +++ b/app/sightings/migrations/0006_auto_20180707_0958.py @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='ap', name='image', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.LuxImage'), ), ] diff --git a/app/sightings/models.py b/app/sightings/models.py index 2a14e85..b54be12 100644 --- a/app/sightings/models.py +++ b/app/sightings/models.py @@ -12,7 +12,7 @@ from django.conf import settings from bs4 import BeautifulSoup from locations.models import Location -from photos.models import LuxImage, LuxImageSize +from media.models import LuxImage, LuxImageSize from utils.next_prev import next_in_order, prev_in_order from utils.util import render_images, extract_main_image, markdown_to_html @@ -186,7 +186,7 @@ class Sighting(models.Model): for img in self.images.all(): for size in img.sizes.all(): if size.width > 360 and size.width < 700: - return img.get_image_by_size(size) + return img.get_image_url_by_size(size) def get_absolute_url(self): return reverse("sightings:detail", kwargs={"slug": self.ap.slug}) diff --git a/app/utils/views.py b/app/utils/views.py index db8cb35..8351ae9 100644 --- a/app/utils/views.py +++ b/app/utils/views.py @@ -7,7 +7,7 @@ from django.apps import apps from django.shortcuts import render from django.template import RequestContext -from photos.models import LuxImage, LuxVideo +from media.models import LuxImage, LuxVideo from recordings.models import Audio diff --git a/config/base_urls.py b/config/base_urls.py index 61dd565..687ad88 100644 --- a/config/base_urls.py +++ b/config/base_urls.py @@ -7,7 +7,6 @@ from django.views.generic.base import RedirectView from pages.views import PageDetailView, PageDetailTXTView, HomePageList from locations.models import WritingbyCountrySitemap -from photos.models import PhotoGallerySitemap from books.models import BookSitemap from posts.models import PostSitemap from pages.models import PageSitemap @@ -48,7 +47,7 @@ urlpatterns = [ path(r'walks/', include('locations.walk_urls')), path(r'locations/', include('locations.urls')), #path(r'expenses/', include('expenses.urls', namespace='expenses')), - path(r'photos/', include('photos.urls')), + #path(r'photos/', include('photos.urls')), path(r'guide/', include('posts.urls.guide_urls', namespace='guide')), path(r'essay/', include('posts.urls.essay_urls')), re_path(r'^essay/$', RedirectView.as_view(url='/essays/')), diff --git a/design/templates/lib/img_archive.html b/design/templates/lib/img_archive.html index a512930..2ca1e93 100644 --- a/design/templates/lib/img_archive.html +++ b/design/templates/lib/img_archive.html @@ -1,5 +1,6 @@ +{% load get_image_by_size %} <img sizes="(max-width: 728px) 100vw, (min-width: 729px) 520px" - srcset="{{image.get_featured_jrnl}} 520w, {{image.get_picwide_sm}} 720w" + srcset="{%get_image_by_size image 'featured_jrnl'%} 520w, {%get_image_by_size image 'picwide_sm'%} 720w" src="{{image.get_featured_jrnl}}" alt="{{image.alt}} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}luxagraf{%endif%}" {% if not nolightbox %}data-jslghtbx="{{image.get_image_by_size}}" data-jslghtbx-group="group" {% if caption%}data-jslghtbx-caption="{{image.caption}}"{%endif%}{%endif%}> |