diff options
24 files changed, 263 insertions, 131 deletions
diff --git a/app/books/migrations/0007_auto_20190131_2351.py b/app/books/migrations/0007_auto_20190131_2351.py new file mode 100644 index 0000000..a8a6c8a --- /dev/null +++ b/app/books/migrations/0007_auto_20190131_2351.py @@ -0,0 +1,24 @@ +# Generated by Django 2.1.1 on 2019-01-31 23:51 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('books', '0006_book_amazon_url'), + ] + + operations = [ + migrations.RemoveField( + model_name='booknote', + name='bookhighlight_ptr', + ), + migrations.RemoveField( + model_name='book', + name='amazon_url', + ), + migrations.DeleteModel( + name='BookNote', + ), + ] diff --git a/app/income/migrations/0006_auto_20190131_2351.py b/app/income/migrations/0006_auto_20190131_2351.py new file mode 100644 index 0000000..1c8f64c --- /dev/null +++ b/app/income/migrations/0006_auto_20190131_2351.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.1 on 2019-01-31 23:51 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('income', '0005_invoice_slug'), + ] + + operations = [ + migrations.AlterModelOptions( + name='invoiceitem', + options={'ordering': ('time_start',)}, + ), + ] diff --git a/app/jrnl/migrations/0025_auto_20190131_2335.py b/app/jrnl/migrations/0025_auto_20190131_2335.py new file mode 100644 index 0000000..60b9a8c --- /dev/null +++ b/app/jrnl/migrations/0025_auto_20190131_2335.py @@ -0,0 +1,28 @@ +# Generated by Django 2.1.1 on 2019-01-31 23:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0024_auto_20180902_1217'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='location_name', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AddField( + model_name='entry', + name='region_name', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AddField( + model_name='entry', + name='state_name', + field=models.CharField(blank=True, max_length=200, null=True), + ), + ] diff --git a/app/jrnl/migrations/0026_entry_country_name.py b/app/jrnl/migrations/0026_entry_country_name.py new file mode 100644 index 0000000..22d07f9 --- /dev/null +++ b/app/jrnl/migrations/0026_entry_country_name.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.1 on 2019-01-31 23:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0025_auto_20190131_2335'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='country_name', + field=models.CharField(blank=True, max_length=200, null=True), + ), + ] diff --git a/app/jrnl/models.py b/app/jrnl/models.py index 809353c..5b7457a 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -4,6 +4,7 @@ import os from django.dispatch import receiver from django.contrib.gis.db import models from django.urls import reverse +from django.utils.functional import cached_property from django.apps import apps from django.conf import settings from django.contrib.sitemaps import Sitemap @@ -44,6 +45,10 @@ class Entry(models.Model): enable_comments = models.BooleanField(default=False) point = models.PointField(null=True, blank=True) location = models.ForeignKey(Location, on_delete=models.CASCADE, null=True, blank=True) + location_name = models.CharField(max_length=200, blank=True, null=True) + state_name = models.CharField(max_length=200, blank=True, null=True) + country_name = models.CharField(max_length=200, blank=True, null=True) + region_name = models.CharField(max_length=200, blank=True, null=True) PUB_STATUS = ( (0, 'Draft'), (1, 'Published'), @@ -122,20 +127,7 @@ class Entry(models.Model): print(self.image.url) image_dir, img = self.image.url.split('post-images/')[1].split('/') print(image_dir, img) - return '%spost-images/%s/%s' % (settings.IMAGES_URL, image_dir, img) - - - @property - def state(self): - return self.location.state - - @property - def country(self): - return self.location.state.country - - @property - def region(self): - return self.location.state.country.lux_region + return '%spost-images/%s/%s' % (settings.IMAGES_URL, image_dir, img) @property def longitude(self): @@ -184,6 +176,10 @@ class Entry(models.Model): 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)) + self.location_name = self.location.name + self.state_name = self.location.state.name + self.country_name = self.location.state.country.name + self.region_name = self.location.state.country.lux_region.name 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 diff --git a/app/jrnl/views.py b/app/jrnl/views.py index cd63482..5dc627e 100644 --- a/app/jrnl/views.py +++ b/app/jrnl/views.py @@ -9,7 +9,7 @@ from django.db.models import Q from utils.views import PaginatedListView from .models import Entry, HomepageCurrator, Home -from locations.models import CheckIn, Country, Region, Location +from locations.models import LuxCheckIn, Country, Region, Location from sightings.models import Sighting @@ -17,8 +17,12 @@ class EntryList(PaginatedListView): """ Return a list of Entries in reverse chronological order """ - queryset = Entry.objects.filter(status__exact=1).order_by('-pub_date').select_related() - template_name = "archives/jrnl.html" + model = Entry + + def get_queryset(self): + queryset = super(EntryList, self).get_queryset() + print(queryset) + return queryset.filter(status__exact=1).order_by('-pub_date').select_related('location').prefetch_related('featured_image') class EntryCountryList(PaginatedListView): @@ -72,21 +76,21 @@ class EntryDetailView(DetailView): template_name = "details/entry.html" slug_field = "slug" - def get_object(self): - obj = get_object_or_404( - self.model, - slug=self.kwargs['slug'], - pub_date__month=self.kwargs['month'], - pub_date__year=self.kwargs['year'] - ) + def get_queryset(self): + queryset = super(EntryDetailView, self).get_queryset() + return queryset.select_related('location').prefetch_related('field_notes').prefetch_related('books') + + def get_object(self, queryset=None): + obj = super(EntryDetailView, self).get_object(queryset=queryset) + self.location = obj.location return obj def get_context_data(self, **kwargs): context = super(EntryDetailView, self).get_context_data(**kwargs) context['wildlife'] = Sighting.objects.filter( - Q(location=self.get_object().location) | - Q(location__in=Location.objects.filter(parent=self.get_object().location)) - ).order_by('ap_id', 'ap__apclass__kind').distinct("ap") + Q(location=self.location) | + Q(location__in=Location.objects.filter(parent=self.location)) + ).select_related().order_by('ap_id', 'ap__apclass__kind').distinct("ap") return context @@ -98,19 +102,24 @@ class HomepageList(ListView): """ Return a main entry and list of Entries in reverse chronological order """ - context_object_name = 'recent' - exclude = Home.objects.get(pk=1) - queryset = Entry.objects.filter(status__exact=1).exclude(pk=exclude.featured.pk)[:8] + model = Entry + + def get_home(self): + return Home.objects.filter(pk=1).prefetch_related('featured_image').select_related('featured').select_related('featured__location').get() + + def get_queryset(self): + queryset = super(HomepageList, self).get_queryset() + self.home = self.get_home() + return queryset.filter(status__exact=1).order_by('-pub_date').exclude().select_related('location').select_related('featured_image')[:8] def get_template_names(self): - obj = Home.objects.get(pk=1) - return ['%s' % obj.template_name] + return ['%s' % self.home.template_name] def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super(HomepageList, self).get_context_data(**kwargs) - context['homepage'] = Home.objects.get(pk=1) - context['location'] = CheckIn.objects.latest() + context['homepage'] = self.home + context['location'] = LuxCheckIn.objects.latest() context['IMAGES_URL'] = settings.IMAGES_URL return context diff --git a/app/links/admin.py b/app/links/admin.py index 3bec927..b1aabc0 100644 --- a/app/links/admin.py +++ b/app/links/admin.py @@ -7,12 +7,10 @@ from django.http import HttpResponseRedirect from utils.widgets import TagListFilter from .models import Link -from .forms import LinkForm @admin.register(Link) class LinkAdmin(admin.ModelAdmin): - form = LinkForm list_display = ('title', 'admin_link', 'pub_date', 'status') search_fields = ['title', 'description', 'url'] list_filter = ['status', TagListFilter] diff --git a/app/links/forms.py b/app/links/forms.py index 80a7c50..b7a2343 100644 --- a/app/links/forms.py +++ b/app/links/forms.py @@ -1,17 +1,4 @@ from django import forms -import dal -from dal_select2_taggit.widgets import TaggitSelect2 from .models import Link from dal import autocomplete - - -class LinkForm(autocomplete.FutureModelForm): - class Meta: - model = Link - fields = ('tags',) - widgets = { - 'tags': autocomplete.TaggitSelect2( - 'tag-autocomplete' - ) - } diff --git a/app/locations/admin.py b/app/locations/admin.py index 26001a4..d644548 100644 --- a/app/locations/admin.py +++ b/app/locations/admin.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin -from .models import Region, Country, Location, State, Route, CheckIn, Campsite +from .models import Region, Country, Location, State, Route, LuxCheckIn, Campsite from utils.widgets import OLAdminBase from utils.util import get_latlon @@ -236,8 +236,8 @@ class RouteAdmin(OSMGeoAdmin): openlayers_url = '/static/admin/js/OpenLayers.js' -@admin.register(CheckIn) -class CheckInAdmin(OLAdminBase): +@admin.register(LuxCheckIn) +class LuxCheckInAdmin(OLAdminBase): list_display = ('date', 'location') # options for OSM map Using custom ESRI topo map default_lat, default_lon = get_latlon() diff --git a/app/locations/migrations/0015_luxcheckin.py b/app/locations/migrations/0015_luxcheckin.py new file mode 100644 index 0000000..085bd9c --- /dev/null +++ b/app/locations/migrations/0015_luxcheckin.py @@ -0,0 +1,33 @@ +# Generated by Django 2.1.1 on 2019-01-31 23:53 + +import django.contrib.gis.db.models.fields +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('locations', '0014_delete_mexstates'), + ] + + operations = [ + migrations.CreateModel( + name='LuxCheckIn', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('point', django.contrib.gis.db.models.fields.PointField(blank=True, srid=4326)), + ('date', models.DateField(default=django.utils.timezone.now)), + ('location_name', models.CharField(blank=True, max_length=200, null=True)), + ('state_name', models.CharField(blank=True, max_length=200, null=True)), + ('country_name', models.CharField(blank=True, max_length=200, null=True)), + ('region_name', models.CharField(blank=True, max_length=200, null=True)), + ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), + ], + options={ + 'ordering': ('-date',), + 'get_latest_by': 'date', + }, + ), + ] diff --git a/app/locations/models.py b/app/locations/models.py index 3ec11b5..203e175 100644 --- a/app/locations/models.py +++ b/app/locations/models.py @@ -204,6 +204,44 @@ class CheckIn(models.Model): super(CheckIn, self).save() +class LuxCheckIn(models.Model): + point = models.PointField(blank=True) + location = models.ForeignKey(Location, on_delete=models.CASCADE, blank=True, null=True) + date = models.DateField(default=timezone.now) + location_name = models.CharField(max_length=200, blank=True, null=True) + state_name = models.CharField(max_length=200, blank=True, null=True) + country_name = models.CharField(max_length=200, blank=True, null=True) + region_name = models.CharField(max_length=200, blank=True, null=True) + + class Meta: + ordering = ('-date',) + get_latest_by = 'date' + + def __str__(self): + return str(self.date) + + @property + def lon(self): + '''Get the site's longitude.''' + return self.point.x + + @property + def lat(self): + '''Get the site's latitude.''' + return self.point.y + + def save(self): + 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)) + self.location_name = self.location.name + self.state_name = self.location.state.name + self.country_name = self.location.state.country.name + self.region_name = self.location.state.country.lux_region.name + super(LuxCheckIn, self).save() + + class Campsite(models.Model): name = models.CharField(max_length=200) point = models.PointField(blank=True) diff --git a/app/photos/models.py b/app/photos/models.py index eb4b55e..2e022e2 100644 --- a/app/photos/models.py +++ b/app/photos/models.py @@ -7,6 +7,7 @@ from django.core.exceptions import ValidationError from django.contrib.gis.db import models from django.contrib.sitemaps import Sitemap from django.utils.encoding import force_text +from django.utils.functional import cached_property from django.urls import reverse from django.apps import apps from django.utils.html import format_html @@ -111,6 +112,32 @@ class LuxImage(models.Model): def get_image_ext(self): return self.image.url[-3:] + @cached_property + def get_featured_jrnl(self): + ''' cached version of getting the primary image for archive page''' + return "%s%s/%s_%s.%s" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), self.get_image_name(), 'featured_jrnl', self.get_image_ext()) + + @cached_property + def get_picwide_sm(self): + ''' cached version of getting the second image for archive page''' + return "%s%s/%s_%s.%s" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), self.get_image_name(), 'picwide-sm', self.get_image_ext()) + + @cached_property + def get_srcset(self): + srcset = "" + for size in self.sizes.all(): + srcset += "%s%s/%s_%s.%s %sw, " % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), self.get_image_name(), size.name, self.get_image_ext(), size.width) + return srcset + + @cached_property + def get_src(self): + src = "" + if self.sizes.all().count() > 1: + src += "%s%s/%s_%s.%s" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), self.get_image_name(), 'picwide-med', self.get_image_ext()) + else: + src += "%s%s/%s_%s.%s" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), self.get_image_name(), [size.name for size in self.sizes.all()], self.get_image_ext()) + return src + def get_image_by_size(self, size="original"): base = self.get_image_name() if size == "admin_insert": @@ -136,6 +163,9 @@ class LuxImage(models.Model): return format_html('<a href="%s"><img src="%s"></a>' % (self.get_image_by_size(), self.get_image_by_size("tn"))) admin_thumbnail.short_description = 'Thumbnail' + def get_sizes(self): + return self.sizes.all() + @property def latitude(self): return self.point.y diff --git a/app/photos/templatetags/get_size_by_name.py b/app/photos/templatetags/get_size_by_name.py new file mode 100644 index 0000000..fc64a61 --- /dev/null +++ b/app/photos/templatetags/get_size_by_name.py @@ -0,0 +1,8 @@ +from django import template + +register = template.Library() + +@register.simple_tag +def get_size_by_name(obj, *args): + method = getattr(obj, "get_size_by_name") + return method(*args) diff --git a/app/sightings/admin.py b/app/sightings/admin.py index 7108bba..d95dd72 100644 --- a/app/sightings/admin.py +++ b/app/sightings/admin.py @@ -1,4 +1,4 @@ -import copy +import copy from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin from .models import APClass, AP, Sighting @@ -6,7 +6,6 @@ from .models import APClass, AP, Sighting from photos.forms import GalleryForm from utils.util import get_latlon from utils.widgets import CustomSelectMultiple, LGEntryForm -from .forms import SightingsForm from django.contrib.admin.options import FORMFIELD_FOR_DBFIELD_DEFAULTS class GalleryFormPlus(GalleryForm): @@ -80,7 +79,6 @@ class APAdmin(admin.ModelAdmin): @admin.register(Sighting) class SightingAdmin(OSMGeoAdmin): - form = SightingsForm list_filter = (('location', admin.RelatedOnlyFieldListFilter),) list_display = ('ap', 'location') # options for OSM map Using custom ESRI topo map diff --git a/app/sightings/autocomplete_light_registry.py b/app/sightings/autocomplete_light_registry.py deleted file mode 100644 index 9c113d0..0000000 --- a/app/sightings/autocomplete_light_registry.py +++ /dev/null @@ -1,14 +0,0 @@ -import autocomplete_light.shortcuts as al -from .models import AP - -al.register(AP, - search_fields=['common_name',], - attrs={ - 'placeholder': 'Animal/Plant...', - 'data-autocomplete-minimum-characters': 2, - }, - widget_attrs={ - 'data-widget-maximum-values': 4, - 'class': 'modern-style', - }, -) diff --git a/app/sightings/forms.py b/app/sightings/forms.py deleted file mode 100644 index 77d61f9..0000000 --- a/app/sightings/forms.py +++ /dev/null @@ -1,12 +0,0 @@ -from dal import autocomplete - -from .models import Sighting - - -class SightingsForm(autocomplete.FutureModelForm): - class Meta: - model = Sighting - fields = ('pub_date','ap', 'point',) - widgets = { - 'ap': autocomplete.ModelSelect2(url='ap-autocomplete') - } diff --git a/app/sightings/views.py b/app/sightings/views.py index f65011c..c90e5c1 100644 --- a/app/sightings/views.py +++ b/app/sightings/views.py @@ -3,7 +3,6 @@ from django.views.generic import ListView from django.contrib.auth.models import User from utils.views import PaginatedListView from .models import AP, Sighting -from dal import autocomplete class SightingListView(PaginatedListView): @@ -57,14 +56,3 @@ class SightingDetailView(DetailView): except Sighting.DoesNotExist: pass return context - - -class APAutocomplete(autocomplete.Select2QuerySetView): - def get_queryset(self): - if not self.request.user.is_authenticated: - return AP.objects.none() - qs = AP.objects.all() - if self.q: - qs = qs.filter(common_name__icontains=self.q) - return qs - diff --git a/app/utils/views.py b/app/utils/views.py index dcb16a8..cd72961 100644 --- a/app/utils/views.py +++ b/app/utils/views.py @@ -2,11 +2,13 @@ from itertools import chain import json from django.http import Http404, HttpResponse from django.views.generic import ListView +from django.apps import apps from photos.models import LuxImage, LuxVideo from django.shortcuts import render_to_response from django.shortcuts import render from django.template import RequestContext + class PaginatedListView(ListView): """ handles my own pagination system @@ -38,26 +40,7 @@ def insert_image(request): reverse=True ) return render(request, 'admin/insert_images.html', {'object_list': object_list, 'textarea_id': request.GET['textarea']}) - - -from taggit.models import Tag - -from dal import autocomplete - -class TagAutocomplete(autocomplete.Select2QuerySetView): - def get_queryset(self): - # Don't forget to filter out results depending on the visitor ! - if not self.request.user.is_authenticated: - return Tag.objects.none() - qs = Tag.objects.all() - - if self.q: - qs = qs.filter(name__istartswith=self.q) - - return qs - -from django.apps import apps def nav_json(request, app, model, pk): model = apps.get_model(app_label=app, model_name=model) diff --git a/config/base_urls.py b/config/base_urls.py index e212e29..3c22638 100644 --- a/config/base_urls.py +++ b/config/base_urls.py @@ -3,21 +3,17 @@ from django.contrib import admin from django.conf.urls.static import static from django.conf import settings from django.contrib.sitemaps.views import sitemap -from django.views.generic import TemplateView from pages.views import PageDetailView from jrnl.models import BlogSitemap from jrnl.views import HomepageList from locations.models import WritingbyCountrySitemap -from locations.views import map_data from photos.models import PhotoGallerySitemap from src.models import SrcSitemap from figments.models import FigmentSitemap from projects.models.base import ProjectSitemap import builder.views import utils.views -from utils.views import TagAutocomplete -from sightings.views import APAutocomplete from locations.views import MapDataList from income.views import MonthlyInvoiceView, DownloadMonthlyInvoiceView @@ -29,12 +25,11 @@ sitemaps = { 'writingbyloc': WritingbyCountrySitemap, 'photos': PhotoGallerySitemap, 'projects': ProjectSitemap, - 'src': SrcSitemap + 'src': SrcSitemap, + 'figments': FigmentSitemap } urlpatterns = [ - path(r'tag-autocomplete/', TagAutocomplete.as_view(), name='tag-autocomplete'), - path(r'ap-autocomplete/', APAutocomplete.as_view(), name='ap-autocomplete'), re_path(r'^admin/build/.*', builder.views.do_build), path(r'admin/data/', include('utils.urls')), path(r'admin/income/invoice/monthlyview/<str:slug>/invoice/', DownloadMonthlyInvoiceView.as_view(), name="download-invoice"), @@ -67,5 +62,9 @@ urlpatterns = [ if settings.DEBUG: import debug_toolbar urlpatterns = [ - path(r'__debug__/', include(debug_toolbar.urls)), + path('__debug__/', include(debug_toolbar.urls)), + + # For django versions before 2.0: + # url(r'^__debug__/', include(debug_toolbar.urls)), + ] + urlpatterns diff --git a/design/templates/archives/homepage-light.html b/design/templates/archives/homepage-light.html index e9bc241..7aaf1aa 100644 --- a/design/templates/archives/homepage-light.html +++ b/design/templates/archives/homepage-light.html @@ -1,5 +1,4 @@ {% extends 'base.html' %} -{% load get_image_by_size %} {% load typogrify_tags %} {% block sitename %} <head itemscope itemtype="http://schema.org/WebSite"> @@ -22,15 +21,17 @@ <figure class="post-image"> <a href="{{object.get_absolute_url}}" title="{{object.title}}">{%with image=homepage.featured_image%} <img class="u-photo" itemprop="image" sizes="(max-width: 960px) 100vw" -srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.name %} {{size.width}}w{% if forloop.last%}"{%else%}, {%endif%}{%endfor%}{% for size in image.sizes.all%}{%if not forloop.first and not forloop.last%} src="{% get_image_by_size image size.name %}"{%endif%}{%endfor%} alt="{{image.alt}} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}luxagraf{%endif%}">{%endwith%} - </a> + srcset="{{image.get_srcset}}" + src="{{image.get_src}}" + alt="{{image.alt}} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}luxagraf{%endif%}"> + </a>{%endwith%} <figcaption> <div class="hero-text-wrapper"> <h2 class="p-name entry-title" itemprop="headline"><a href="{{object.get_absolute_url}}" class="u-url" title="{%if object.title_keywords%}{{object.title_keywords}}{%else%}{{object.title}}{%endif%}">{{object.title|safe|smartypants}}</a></h2> <p class="p-author author hide" itemprop="author">Scott Gilbertson</p> <time class="dt-published published dt-updated post--date" datetime="{{object.pub_date|date:'c'}}">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time> <p class="post-summary"> - <span class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place">{% if object.country.name == "United States" %}<span class="p-locality locality">{{object.location.name|smartypants|safe}}</span>, {{object.state.name}}, <span class="p-country-name">U.S.</span>{%else%}<span class="p-region">{{object.location.name|smartypants|safe}}</span>, {{object.country.name}}{%endif%}</span> + <span class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place">{% if object.country_name == "United States" %}<span class="p-locality locality">{{object.location_name|smartypants|safe}}</span>, {{object.state_name}}}, <span class="p-country-name">U.S.</span>{%else%}<span class="p-region">{{object.location_name|smartypants|safe}}</span>, {{object.country_name}}{%endif%}</span> <span class="p-summary" itemprop="description"> {{homepage.tag_line|safe|smartypants}} </span> @@ -45,7 +46,7 @@ srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.name %} <h1 class="homepage-section-header">About Luxagraf</h1> <img src="/media/img/usa-resize.svg" alt="map of travels" class="homepage-map-img" /> <p>After nearly two years exploring the U.S. in our home, a 1969 Dodge Travco RV, we left the states to spend the winter in Mexico.</p> - <p>We left our former home in Athens, GA in the Spring of 2017. We were most recently in <span class="p-location h-adr adr " itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> {% if location.location.state.country.name == "United States" %}<span class="p-locality locality">{{location.location.name|smartypants|safe}}</span>, {{location.location.state.code|safe}}{%else%}<span class="p-region">{{location.location.name|smartypants|safe}}</span>, {{location.location.state.country.name|safe}}</a>{%endif%}</span>. The map <span class="addafter"><span class="subcontent">above</span></span> has a rough sketch of our route to date. You can read about our adventures in the <a href="/jrnl/">journal</a> section. There's more about us on the <a href="/about">about page</a> </p> + <p>We left our former home in Athens, GA in the Spring of 2017. We were most recently in <span class="p-location h-adr adr " itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> {% if location.country_name == "United States" %}<span class="p-locality locality">{{location.location_name|smartypants|safe}}</span>, {{location.location.state.code|safe}}{%else%}<span class="p-region">{{location.location_name|smartypants|safe}}</span>, {{location.country_name|safe}}</a>{%endif%}</span>. The map <span class="addafter"><span class="subcontent">above</span></span> has a rough sketch of our route to date. You can read about our adventures in the <a href="/jrnl/">journal</a> section. There's more about us on the <a href="/about">about page</a> </p> </section> <section class="recent-popular"> <div class="recent"> @@ -63,7 +64,7 @@ srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.name %} <time class="dt-published published dt-updated post-date" datetime="{{object.pub_date|date:'c'}}">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time> <p class="post-summary"> <span class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> - {% if object.country.name == "United States" %}<span class="p-locality locality">{{object.location.name|smartypants|safe}}</span>, <a class="p-region region" href="/jrnl/united-states/" title="travel writing from the United States">{{object.state.name}}</a>, <span class="p-country-name">U.S.</span>{%else%}<span class="p-region">{{object.location.name|smartypants|safe}}</span>, <a class="p-country-name country-name" href="/jrnl/{{object.country.slug}}/" title="travel writing from {{object.country.name}}">{{object.country.name}}</a>{%endif%} + {% if object.country_name == "United States" %}<span class="p-locality locality">{{object.location_name|smartypants|safe}}</span>, <a class="p-region region" href="/jrnl/united-states/" title="travel writing from the United States">{{object.state_name}}</a>, <span class="p-country-name">U.S.</span>{%else%}<span class="p-region">{{object.location_name|smartypants|safe}}</span>, <a class="p-country-name country-name" href="/jrnl/{{object.country.slug}}/" title="travel writing from {{object.country_name}}">{{object.country_name}}</a>{%endif%} </span> </p> </article> {% endfor %} @@ -84,7 +85,7 @@ srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.name %} <time class="dt-published published dt-updated post-date" datetime="{{object.pub_date|date:'c'}}">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time> <p class="post-summary"> <span class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> - {% if object.country.name == "United States" %}<span class="p-locality locality">{{object.location.name|smartypants|safe}}</span>, <a class="p-region region" href="/jrnl/united-states/" title="travel writing from the United States">{{object.state.name}}</a>, <span class="p-country-name">U.S.</span>{%else%}<span class="p-region">{{object.location.name|smartypants|safe}}</span>, <a class="p-country-name country-name" href="/jrnl/{{object.country.slug}}/" title="travel writing from {{object.country.name}}">{{object.country.name}}</a>{%endif%} + {% if object.country_name == "United States" %}<span class="p-locality locality">{{object.location_name|smartypants|safe}}</span>, <a class="p-region region" href="/jrnl/united-states/" title="travel writing from the United States">{{object.state_name}}</a>, <span class="p-country-name">U.S.</span>{%else%}<span class="p-region">{{object.location_name|smartypants|safe}}</span>, <a class="p-country-name country-name" href="/jrnl/{{object.country.slug}}/" title="travel writing from {{object.country_name}}">{{object.country_name}}</a>{%endif%} </span> </p> </article> {% endfor %} diff --git a/design/templates/base.html b/design/templates/base.html index a96d76e..d0d1618 100644 --- a/design/templates/base.html +++ b/design/templates/base.html @@ -40,7 +40,7 @@ <li id="laverdad"><a href="/jrnl/" title="What we've been up to lately">Journal</a></li> <!--<li id="nota"><a href="/field-notes/" title="Quick notes and images from the road">Notes</a></li> <li id="fotos"><a href="/photos/" title="Photos from travels around the world">Photos</a></li>i--> - <li id="maps"><a href="/map" title="Maps">Map</a></li> + <!--<li id="maps"><a href="/map" title="Maps">Map</a></li>--> <li id="about"><a href="/about" title="About Luxagraf">About</a></li> <li id="etc" class="last"><a href="/projects/" title="the less visible portions of the iceberg">More</a></li> </ul> diff --git a/design/templates/details/entry.html b/design/templates/details/entry.html index ad98274..2804da3 100644 --- a/design/templates/details/entry.html +++ b/design/templates/details/entry.html @@ -9,7 +9,7 @@ <link rel="canonical" href="https://luxagraf.net{{object.get_absolute_url}}" /> <meta name="ICBM" content="{{object.latitude}}, {{object.longitude}}" /> <meta name="geo.position" content="{{object.latitude}}; {{object.longitude}}" /> - <meta name="geo.placename" content="{% if object.country.name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.state.name}}{%else%}{{object.location.name|smartypants|safe}}, {{object.country.name}}{%endif%}"> + <meta name="geo.placename" content="{% if object.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.state.name}}{%else%}{{object.location.name|smartypants|safe}}, {{object.country_name}}{%endif%}"> <meta name="geo.region" content="{{object.country.iso2}}{%if object.state.code != '' %}-{{object.state.code}}{%endif%}"> <meta property="og:type" content="article" /> <meta property="og:title" content="{{object.title|safe}}" /> diff --git a/design/templates/archives/jrnl.html b/design/templates/jrnl/entry_list.html index c95215e..d58bd05 100644 --- a/design/templates/archives/jrnl.html +++ b/design/templates/jrnl/entry_list.html @@ -1,6 +1,5 @@ {% extends 'base.html' %} {% load typogrify_tags %} -{% load get_image_by_size %} {% load pagination_tags %} {% block pagetitle %}Luxagraf | {% if region %}Travel Writing from {{region.name|title|smartypants|safe}}{%else%}Travel Writing from Around the World {%endif%}{% if page != "1" %} -- Page {{page}}{%endif%}{% endblock %} diff --git a/design/templates/lib/img_archive.html b/design/templates/lib/img_archive.html index 2d00e78..22b0cce 100644 --- a/design/templates/lib/img_archive.html +++ b/design/templates/lib/img_archive.html @@ -1,2 +1,6 @@ {% load get_image_by_size %} -<img sizes="(max-width: 728px) 100vw, (min-width: 729px) 520px" srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.name %} {{size.width}}w{% if forloop.last%}"{%else%}, {%endif%}{%endfor%}{% for size in image.sizes.all%}{%if not forloop.first and not forloop.last%} src="{% get_image_by_size image size.name%}"{%endif%}{%endfor%} alt="{{image.alt}} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}luxagraf{%endif%}" data-jslghtbx="{%get_image_by_size image "original"%}" data-jslghtbx-group="group" {% if caption%}data-jslghtbx-caption="{{image.caption}}"{%endif%}> +<img sizes="(max-width: 728px) 100vw, (min-width: 729px) 520px" + srcset="{{image.get_featured_jrnl}} 520w, {{image.get_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%}" + data-jslghtbx="{{image.get_image_by_size}}" data-jslghtbx-group="group" {% if caption%}data-jslghtbx-caption="{{image.caption}}"{%endif%}> |