diff options
Diffstat (limited to 'app/unused_apps/jrnl')
68 files changed, 2393 insertions, 0 deletions
diff --git a/app/unused_apps/jrnl/__init__.py b/app/unused_apps/jrnl/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/unused_apps/jrnl/__init__.py diff --git a/app/unused_apps/jrnl/admin.py b/app/unused_apps/jrnl/admin.py new file mode 100644 index 0000000..32ef69b --- /dev/null +++ b/app/unused_apps/jrnl/admin.py @@ -0,0 +1,129 @@ +from django.contrib import admin +from django import forms +from django.contrib.gis.admin import OSMGeoAdmin +from django.contrib.contenttypes.admin import GenericStackedInline + +from utils.widgets import AdminImageWidget, LGEntryForm +from .models import Entry, HomepageCurrator, Home #, RelatedPost + +from photos.forms import GalleryForm +from photos.models import LuxImage +from utils.util import get_latlon + + +#@admin.register(RelatedPost) +#class RelatedPostAdmin(admin.ModelAdmin): +# pass + + +@admin.register(Entry) +class EntryAdmin(OSMGeoAdmin): + form = LGEntryForm + + def get_queryset(self, request): + test_model_qs = super(EntryAdmin, self).get_queryset(request) + test_model_qs = test_model_qs.prefetch_related('related').prefetch_related('books') + + return test_model_qs + + def render_change_form(self, request, context, *args, **kwargs): + #context['adminform'].form.fields['featured_image'].queryset = LuxImage.objects.all()[:200] + return super(EntryAdmin, self).render_change_form(request, context, *args, **kwargs) + + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'thumbnail' or db_field.name == 'image': + field = forms.FileField(widget=AdminImageWidget) + elif db_field.name == 'meta_description': + field = forms.CharField(widget=forms.Textarea(attrs={'rows': 4, 'cols': 75})) + field.required = False + else: + field = super(EntryAdmin, self).formfield_for_dbfield(db_field, **kwargs) + return field + + list_display = ('title', 'pub_date', 'template_name', 'status', 'location', 'photo_gallery') + search_fields = ['title', 'body_markdown'] + prepopulated_fields = {"slug": ('title',)} + list_filter = ('pub_date', 'enable_comments', 'status', 'location__state__country__lux_region') + filter_horizontal = ('field_notes', 'books', 'related') + fieldsets = ( + ('Entry', { + 'fields': ( + 'title', + 'subtitle', + 'body_markdown', + ('pub_date', 'status'), + 'slug', + 'point' + ), + 'classes': ( + 'show', + 'extrapretty', + 'wide' + ) + } + ), + ('Formatting data', { + 'fields': ( + 'dek', + 'meta_description', + 'template_name', + 'enable_comments', + 'featured_image', + ), + }), + ('Extra', { + 'fields': ( + 'field_notes', + #'old_field_notes', + 'books', + 'related', + #'oldrelated', + ), + 'classes': ( + 'collapse', + 'extrapretty', + 'wide' + ) + }), + ) + # options for OSM map Using custom ESRI topo map + lat, lon = get_latlon() + default_lon = lon + default_lat = lat + default_zoom = 10 + units = True + scrollable = False + map_width = 700 + map_height = 425 + map_template = 'gis/admin/osm.html' + openlayers_url = '/static/admin/js/OpenLayers.js' + + class Media: + js = ('image-loader.js', 'next-prev-links.js') + css = { + "all": ("my_styles.css",) + } + + +@admin.register(HomepageCurrator) +class HomepageCurratorAdmin(admin.ModelAdmin): + form = GalleryForm + filter_horizontal = ('popular',) + + class Media: + js = ('image-loader.js', 'next-prev-links.js') + css = { + "all": ("my_styles.css",) + } + + +@admin.register(Home) +class HomeAdmin(admin.ModelAdmin): + form = LGEntryForm + filter_horizontal = ('popular',) + + class Media: + js = ('image-loader.js', 'next-prev-links.js') + css = { + "all": ("my_styles.css",) + } diff --git a/app/unused_apps/jrnl/build.py b/app/unused_apps/jrnl/build.py new file mode 100644 index 0000000..dcebace --- /dev/null +++ b/app/unused_apps/jrnl/build.py @@ -0,0 +1,100 @@ +from django.urls import reverse +from django.apps import apps +from builder.base import BuildNew +from itertools import chain + +from django.conf import settings + + +class BuildJrnl(BuildNew): + + def build(self): + self.build_list_view( + base_path=reverse("jrnl:list"), + paginate_by=24 + ) + self.build_year_view("jrnl:list_year") + self.build_month_view("jrnl:list_month") + self.build_detail_view() + self.build_location_view() + self.build_feed("jrnl:feed") + self.build_latest() + + def build_arc(self): + self.build_list_view( + base_path=reverse("jrnl:list"), + paginate_by=24 + ) + self.build_year_view("jrnl:list_year") + self.build_month_view("jrnl:list_month") + self.build_location_view() + + def build_location_view(self): + c = apps.get_model('locations', 'Country') + r = apps.get_model('locations', 'Region') + countries = c.objects.filter(visited=True) + regions = r.objects.all() + locations = list(chain(countries, regions)) + for c in locations: + try: + qs = self.model.objects.filter( + status__exact=1, + location__state__country=c + ) + except: + qs = self.model.objects.filter( + status__exact=1, + location__state__country__lux_region=c.id + ) + print(c) + pages = self.get_pages(qs, 24) + for page in range(pages): + base_path = reverse("jrnl:list_country", kwargs={'slug': c.slug, 'page': page + 1}) + response = self.client.get(base_path) + print(response.content) + if page == 0: + self.write_file(base_path, response.content) + else: + self.write_file(base_path, response.content) + + def build_homepage(self): + response = self.client.get('/') + self.write_file('', response.content) + + def build_latest(self): + response = self.client.get('/jrnl/latest/') + self.write_file(reverse("jrnl:latest"), response.content) + + def build_map(self): + self.build_list_view( + base_path=reverse("map:maplist"), + paginate_by=1000000 + ) + response = self.client.get(reverse("map:mapdata")) + self.write_file("media/js/mainmap", response.content, 'js', '') + + +def archive_builder(): + j = BuildJrnl("jrnl", "entry") + j.build_arc() + + +def detail_builder(): + j = BuildJrnl("jrnl", "entry") + j.build_latest() + j.build_detail_view() + + +def home_builder(): + j = BuildJrnl("jrnl", "entry") + j.build_homepage() + + +def rss_builder(): + j = BuildJrnl("jrnl", "entry") + j.build_feed("jrnl:feed") + + +def map_builder(): + j = BuildJrnl("jrnl", "entry") + j.build_map() diff --git a/app/unused_apps/jrnl/export.py b/app/unused_apps/jrnl/export.py new file mode 100644 index 0000000..6407491 --- /dev/null +++ b/app/unused_apps/jrnl/export.py @@ -0,0 +1,20 @@ +from django.template.loader import render_to_string +from django.template import Context + + +def write_file(entry): + body = '' + lines = entry.body_markdown.split('\n') + for line in lines: + if line.strip(): + if line.startswith('<break>'): + pass + else: + body += line.strip()+'\n\n' + img = entry.image.name[19:] + c = Context({'object': entry, 'body': body, 'image': img},) + t = render_to_string('details/jrnl-export.html', c).encode('utf-8') + filepath = 'temp/%s-%s.txt' % (entry.pub_date.strftime("%Y-%m-%d").lower(), entry.slug) + f = open(filepath, 'wb') + f.write(t) + f.close() diff --git a/app/unused_apps/jrnl/fields.py b/app/unused_apps/jrnl/fields.py new file mode 100644 index 0000000..8df2f5e --- /dev/null +++ b/app/unused_apps/jrnl/fields.py @@ -0,0 +1,7 @@ +from django import forms + +from .widgets import AdminImageWidget + + +class FileUploadForm(forms.ModelForm): + upload = forms.FileField(widget=AdminImageWidget) diff --git a/app/unused_apps/jrnl/migrations/0001_initial.py b/app/unused_apps/jrnl/migrations/0001_initial.py new file mode 100644 index 0000000..a3660ab --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0001_initial.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-03-09 10:13 +from __future__ import unicode_literals + +import django.contrib.gis.db.models.fields +from django.db import migrations, models +import django.db.models.deletion +import jrnl.models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + #('locations', '__first__'), + ('photos', '0003_luxgallery_caption_style'), + ] + + operations = [ + 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()), + ('dek', models.TextField(blank=True, null=True)), + ('pub_date', models.DateTimeField(verbose_name='Date published')), + ('enable_comments', models.BooleanField(default=False)), + ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)), + ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0)), + ('image', models.FileField(blank=True, help_text='should be 205px high', null=True, upload_to=jrnl.models.get_upload_path)), + ('meta_description', models.CharField(blank=True, max_length=256, null=True)), + ('template_name', models.IntegerField(choices=[(0, 'single'), (1, 'double'), (2, 'single-dark'), (3, 'double-dark'), (4, 'bigimg'), (5, 'bigimg-dark')], default=0)), + ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), + ('photo_gallery', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.PhotoGallery', verbose_name='photo set')), + ], + options={ + 'verbose_name_plural': 'entries', + 'get_latest_by': 'pub_date', + 'ordering': ('-pub_date',), + }, + ), + migrations.CreateModel( + name='EntryAside', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('body', models.TextField(blank=True, null=True)), + ('entry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='jrnl.Entry')), + ], + ), + migrations.CreateModel( + name='HomepageCurrator', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('alt_text', models.CharField(max_length=200)), + ('image_base_url', models.CharField(max_length=200)), + ('tag_line', models.CharField(max_length=200)), + ('template_name', models.CharField(help_text='full path', max_length=200)), + ('banner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='banner', to='jrnl.Entry')), + ('entry_list', models.ManyToManyField(to='jrnl.Entry')), + ], + ), + migrations.CreateModel( + name='PostImage', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=100)), + ('image', models.ImageField(upload_to='/Users/sng/Sites/luxagraf/site/media/images/2016')), + ], + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0001_squashed_0019_remove_entry_thumbnail.py b/app/unused_apps/jrnl/migrations/0001_squashed_0019_remove_entry_thumbnail.py new file mode 100644 index 0000000..7b1b247 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0001_squashed_0019_remove_entry_thumbnail.py @@ -0,0 +1,81 @@ +# Generated by Django 2.0.1 on 2018-07-07 15:30 + +import django.contrib.gis.db.models.fields +from django.db import migrations, models +import django.db.models.deletion +import jrnl.models + + +class Migration(migrations.Migration): + + replaces = [('jrnl', '0001_initial'), ('jrnl', '0002_entrytitlesong'), ('jrnl', '0003_auto_20160309_1018'), ('jrnl', '0004_auto_20160309_1031'), ('jrnl', '0005_auto_20160514_2151'), ('jrnl', '0006_auto_20160715_0703'), ('jrnl', '0007_delete_postimage'), ('jrnl', '0008_auto_20160906_0845'), ('jrnl', '0009_homepagecurrator_image_offset_vertical'), ('jrnl', '0010_auto_20161102_0916'), ('jrnl', '0011_auto_20161102_0925'), ('jrnl', '0012_auto_20161102_0930'), ('jrnl', '0013_entry_featured_image'), ('jrnl', '0014_homepagecurrator'), ('jrnl', '0015_entry_has_video'), ('jrnl', '0016_auto_20161219_1058'), ('jrnl', '0017_entry_field_notes'), ('jrnl', '0018_auto_20180303_1037'), ('jrnl', '0019_remove_entry_thumbnail')] + + initial = True + + dependencies = [ + ('photos', '0016_auto_20161022_1411'), + ('books', '0005_auto_20171214_2239'), + ('photos', '0010_auto_20160517_0906'), + ('photos', '0003_luxgallery_caption_style'), + ] + + operations = [ + 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()), + ('dek', models.TextField(blank=True, null=True)), + ('pub_date', models.DateTimeField(verbose_name='Date published')), + ('enable_comments', models.BooleanField(default=False)), + ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)), + ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0)), + ('image', models.FileField(blank=True, help_text='should be 205px high by 364px wide', null=True, upload_to=jrnl.models.get_upload_path)), + ('meta_description', models.CharField(blank=True, max_length=256, null=True)), + ('template_name', models.IntegerField(choices=[(0, 'single'), (1, 'double'), (2, 'single-dark'), (3, 'double-dark'), (4, 'single-black'), (5, 'double-black')], default=0)), + ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), + ('photo_gallery', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.PhotoGallery', verbose_name='photo set')), + ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage')), + ], + options={ + 'verbose_name_plural': 'entries', + 'get_latest_by': 'pub_date', + 'ordering': ('-pub_date',), + }, + ), + migrations.CreateModel( + name='HomepageCurrator', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('image_offset_vertical', models.CharField(help_text='add negative top margin to shift image (include css unit)', max_length=20)), + ('tag_line', models.CharField(max_length=200)), + ('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='jrnl.Entry')), + ('images', models.ManyToManyField(to='photos.LuxImage')), + ('popular', models.ManyToManyField(to='jrnl.Entry')), + ], + ), + migrations.AddField( + model_name='entry', + name='has_video', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='entry', + name='image', + field=models.FileField(blank=True, help_text='should be 520 by 290', null=True, upload_to=jrnl.models.get_upload_path), + ), + migrations.AddField( + model_name='entry', + name='field_notes', + field=models.ManyToManyField(blank=True, to='fieldnotes.FieldNote'), + ), + migrations.AddField( + model_name='entry', + name='books', + field=models.ManyToManyField(blank=True, to='books.Book'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0002_entrytitlesong.py b/app/unused_apps/jrnl/migrations/0002_entrytitlesong.py new file mode 100644 index 0000000..66a75a6 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0002_entrytitlesong.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-03-09 10:13 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='EntryTitleSong', + 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)), + ('pub_date', models.DateField(verbose_name='Date published')), + ('entry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='jrnl.Entry')), + ], + options={ + 'ordering': ('-pub_date',), + 'get_latest_by': 'pub_date', + 'verbose_name_plural': 'Entry Title Songs', + }, + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0003_auto_20160309_1018.py b/app/unused_apps/jrnl/migrations/0003_auto_20160309_1018.py new file mode 100644 index 0000000..49a3f6f --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0003_auto_20160309_1018.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-03-09 10:18 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0002_entrytitlesong'), + ] + + operations = [ + migrations.AddField( + model_name='entrytitlesong', + name='album', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AddField( + model_name='entrytitlesong', + name='band', + field=models.CharField(default='none', max_length=200), + preserve_default=False, + ), + migrations.AddField( + model_name='entrytitlesong', + name='song', + field=models.CharField(blank=True, max_length=200, null=True), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0004_auto_20160309_1031.py b/app/unused_apps/jrnl/migrations/0004_auto_20160309_1031.py new file mode 100644 index 0000000..33bbe05 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0004_auto_20160309_1031.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-03-09 10:31 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0003_auto_20160309_1018'), + ] + + operations = [ + migrations.AddField( + model_name='entrytitlesong', + name='body_markdown', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='entrytitlesong', + name='listen_link', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AlterField( + model_name='entrytitlesong', + name='slug', + field=models.SlugField(blank=True, unique_for_date='pub_date'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0005_auto_20160514_2151.py b/app/unused_apps/jrnl/migrations/0005_auto_20160514_2151.py new file mode 100644 index 0000000..701c8c3 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0005_auto_20160514_2151.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-05-14 21:51 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0004_auto_20160309_1031'), + ] + + operations = [ + migrations.AlterField( + model_name='entrytitlesong', + name='title', + field=models.CharField(blank=True, max_length=200), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0006_auto_20160715_0703.py b/app/unused_apps/jrnl/migrations/0006_auto_20160715_0703.py new file mode 100644 index 0000000..42efc43 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0006_auto_20160715_0703.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-15 07:03 +from __future__ import unicode_literals + +from django.db import migrations, models +import jrnl.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0010_auto_20160517_0906'), + ('jrnl', '0005_auto_20160514_2151'), + ] + + operations = [ + migrations.AddField( + model_name='homepagecurrator', + name='images', + field=models.ManyToManyField(to='photos.LuxImage'), + ), + migrations.AlterField( + model_name='entry', + name='image', + field=models.FileField(blank=True, help_text='should be 205px high by 364px wide', null=True, upload_to=jrnl.models.get_upload_path), + ), + migrations.AlterField( + model_name='entry', + name='template_name', + field=models.IntegerField(choices=[(0, 'single'), (1, 'double'), (2, 'single-dark'), (3, 'double-dark'), (4, 'single-black'), (5, 'double-black')], default=0), + ), + migrations.AlterField( + model_name='postimage', + name='image', + field=models.ImageField(upload_to='/home/lxf/Sites/luxagraf/site/media/images/2016'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0007_delete_postimage.py b/app/unused_apps/jrnl/migrations/0007_delete_postimage.py new file mode 100644 index 0000000..cc481e8 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0007_delete_postimage.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-15 07:05 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0006_auto_20160715_0703'), + ] + + operations = [ + migrations.DeleteModel( + name='PostImage', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0008_auto_20160906_0845.py b/app/unused_apps/jrnl/migrations/0008_auto_20160906_0845.py new file mode 100644 index 0000000..4ac5ebf --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0008_auto_20160906_0845.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-09-06 08:45 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0007_delete_postimage'), + ] + + operations = [ + migrations.RenameField( + model_name='homepagecurrator', + old_name='banner', + new_name='featured', + ), + migrations.RenameField( + model_name='homepagecurrator', + old_name='entry_list', + new_name='popular', + ), + migrations.RemoveField( + model_name='homepagecurrator', + name='alt_text', + ), + migrations.RemoveField( + model_name='homepagecurrator', + name='image_base_url', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0009_homepagecurrator_image_offset_vertical.py b/app/unused_apps/jrnl/migrations/0009_homepagecurrator_image_offset_vertical.py new file mode 100644 index 0000000..5dfbbad --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0009_homepagecurrator_image_offset_vertical.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-09-06 09:01 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0008_auto_20160906_0845'), + ] + + operations = [ + migrations.AddField( + model_name='homepagecurrator', + name='image_offset_vertical', + field=models.CharField(default='160px', help_text='add negative top margin to shift image (include css unit)', max_length=20), + preserve_default=False, + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0010_auto_20161102_0916.py b/app/unused_apps/jrnl/migrations/0010_auto_20161102_0916.py new file mode 100644 index 0000000..a2d9eb8 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0010_auto_20161102_0916.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:16 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0009_homepagecurrator_image_offset_vertical'), + ] + + operations = [ + migrations.RemoveField( + model_name='entryaside', + name='entry', + ), + migrations.DeleteModel( + name='EntryAside', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0011_auto_20161102_0925.py b/app/unused_apps/jrnl/migrations/0011_auto_20161102_0925.py new file mode 100644 index 0000000..e11c1ba --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0011_auto_20161102_0925.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:25 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0010_auto_20161102_0916'), + ] + + operations = [ + migrations.RemoveField( + model_name='entrytitlesong', + name='entry', + ), + migrations.DeleteModel( + name='EntryTitleSong', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0012_auto_20161102_0930.py b/app/unused_apps/jrnl/migrations/0012_auto_20161102_0930.py new file mode 100644 index 0000000..d1a65dd --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0012_auto_20161102_0930.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:30 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0011_auto_20161102_0925'), + ] + + operations = [ + migrations.RemoveField( + model_name='homepagecurrator', + name='featured', + ), + migrations.RemoveField( + model_name='homepagecurrator', + name='images', + ), + migrations.RemoveField( + model_name='homepagecurrator', + name='popular', + ), + migrations.DeleteModel( + name='HomepageCurrator', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0013_entry_featured_image.py b/app/unused_apps/jrnl/migrations/0013_entry_featured_image.py new file mode 100644 index 0000000..c607ca7 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0013_entry_featured_image.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0016_auto_20161022_1411'), + ('jrnl', '0012_auto_20161102_0930'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='featured_image', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0014_homepagecurrator.py b/app/unused_apps/jrnl/migrations/0014_homepagecurrator.py new file mode 100644 index 0000000..2d34866 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0014_homepagecurrator.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0016_auto_20161022_1411'), + ('jrnl', '0013_entry_featured_image'), + ] + + operations = [ + migrations.CreateModel( + name='HomepageCurrator', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('image_offset_vertical', models.CharField(help_text='add negative top margin to shift image (include css unit)', max_length=20)), + ('tag_line', models.CharField(max_length=200)), + ('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='jrnl.Entry')), + ('images', models.ManyToManyField(to='photos.LuxImage')), + ('popular', models.ManyToManyField(to='jrnl.Entry')), + ], + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0015_entry_has_video.py b/app/unused_apps/jrnl/migrations/0015_entry_has_video.py new file mode 100644 index 0000000..b643342 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0015_entry_has_video.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + ('photos', '0016_auto_20161022_1411'), + ('jrnl', '0014_homepagecurrator'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='has_video', + field=models.BooleanField(blank=True, default=False), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0016_auto_20161219_1058.py b/app/unused_apps/jrnl/migrations/0016_auto_20161219_1058.py new file mode 100644 index 0000000..f9a3fc8 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0016_auto_20161219_1058.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-12-19 10:58 +from __future__ import unicode_literals + +from django.db import migrations, models +import jrnl.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0015_entry_has_video'), + ] + + operations = [ + migrations.AlterField( + model_name='entry', + name='image', + field=models.FileField(blank=True, help_text='should be 520 by 290', null=True, upload_to=jrnl.models.get_upload_path), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0017_entry_field_notes.py b/app/unused_apps/jrnl/migrations/0017_entry_field_notes.py new file mode 100644 index 0000000..f131183 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0017_entry_field_notes.py @@ -0,0 +1,13 @@ +# Generated by Django 2.0.1 on 2018-02-08 07:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0016_auto_20161219_1058'), + ] + + operations = [ + ] diff --git a/app/unused_apps/jrnl/migrations/0018_auto_20180303_1037.py b/app/unused_apps/jrnl/migrations/0018_auto_20180303_1037.py new file mode 100644 index 0000000..2b4baa6 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0018_auto_20180303_1037.py @@ -0,0 +1,24 @@ +# Generated by Django 2.0.1 on 2018-03-03 10:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('books', '0005_auto_20171214_2239'), + ('jrnl', '0017_entry_field_notes'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='books', + field=models.ManyToManyField(blank=True, to='books.Book'), + ), + migrations.AlterField( + model_name='entry', + name='field_notes', + field=models.ManyToManyField(blank=True, to='sketches.Sketch'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0019_remove_entry_thumbnail.py b/app/unused_apps/jrnl/migrations/0019_remove_entry_thumbnail.py new file mode 100644 index 0000000..971cb03 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0019_remove_entry_thumbnail.py @@ -0,0 +1,13 @@ +# Generated by Django 2.0.1 on 2018-06-06 10:58 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0018_auto_20180303_1037'), + ] + + operations = [ + ] diff --git a/app/unused_apps/jrnl/migrations/0020_auto_20180606_1058.py b/app/unused_apps/jrnl/migrations/0020_auto_20180606_1058.py new file mode 100644 index 0000000..7575d4f --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0020_auto_20180606_1058.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0.1 on 2018-06-06 10:58 + +from django.db import migrations, models +import jrnl.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0019_remove_entry_thumbnail'), + ] + + operations = [ + migrations.AlterField( + model_name='entry', + name='image', + field=models.FileField(blank=True, help_text='should be 520 by 290', upload_to=jrnl.models.get_upload_path), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0021_auto_20180606_1058.py b/app/unused_apps/jrnl/migrations/0021_auto_20180606_1058.py new file mode 100644 index 0000000..ab42290 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0021_auto_20180606_1058.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0.1 on 2018-06-06 10:58 + +from django.db import migrations, models +import jrnl.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0020_auto_20180606_1058'), + ] + + operations = [ + migrations.AlterField( + model_name='entry', + name='image', + field=models.FileField(blank=True, help_text='should be 520 by 290', null=True, upload_to=jrnl.models.get_upload_path), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0022_auto_20180707_0958.py b/app/unused_apps/jrnl/migrations/0022_auto_20180707_0958.py new file mode 100644 index 0000000..809f562 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0022_auto_20180707_0958.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0.1 on 2018-07-07 09:58 + +from django.db import migrations, models +import jrnl.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0021_auto_20180606_1058'), + ] + + operations = [ + migrations.AlterField( + model_name='entry', + name='image', + field=models.FileField(blank=True, help_text='should be 520 by 290', upload_to=jrnl.models.get_upload_path), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0023_auto_20180902_1210.py b/app/unused_apps/jrnl/migrations/0023_auto_20180902_1210.py new file mode 100644 index 0000000..0ce3853 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0023_auto_20180902_1210.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1 on 2018-09-02 12:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0022_auto_20180707_0958'), + ] + + operations = [ + migrations.AlterField( + model_name='entry', + name='has_video', + field=models.BooleanField(blank=True, default=False), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0024_auto_20180902_1217.py b/app/unused_apps/jrnl/migrations/0024_auto_20180902_1217.py new file mode 100644 index 0000000..314c8c6 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0024_auto_20180902_1217.py @@ -0,0 +1,32 @@ +# Generated by Django 2.1 on 2018-09-02 12:17 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0018_auto_20161130_1218'), + ('jrnl', '0023_auto_20180902_1210'), + ] + + operations = [ + migrations.CreateModel( + name='Home', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('image_offset_vertical', models.CharField(help_text='add negative top margin to shift image (include css unit)', max_length=20)), + ('tag_line', models.CharField(max_length=200)), + ('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='jrnl.Entry')), + ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage')), + ('popular', models.ManyToManyField(to='jrnl.Entry')), + ], + ), + migrations.AlterField( + model_name='homepagecurrator', + name='featured', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='oldbanner', to='jrnl.Entry'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0025_auto_20190131_2335.py b/app/unused_apps/jrnl/migrations/0025_auto_20190131_2335.py new file mode 100644 index 0000000..60b9a8c --- /dev/null +++ b/app/unused_apps/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/unused_apps/jrnl/migrations/0026_entry_country_name.py b/app/unused_apps/jrnl/migrations/0026_entry_country_name.py new file mode 100644 index 0000000..22d07f9 --- /dev/null +++ b/app/unused_apps/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/unused_apps/jrnl/migrations/0027_entry_country_slug.py b/app/unused_apps/jrnl/migrations/0027_entry_country_slug.py new file mode 100644 index 0000000..4560497 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0027_entry_country_slug.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-02-15 21:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0026_entry_country_name'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='country_slug', + field=models.CharField(blank=True, max_length=200, null=True), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0028_auto_20190218_1614.py b/app/unused_apps/jrnl/migrations/0028_auto_20190218_1614.py new file mode 100644 index 0000000..aff2331 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0028_auto_20190218_1614.py @@ -0,0 +1,33 @@ +# Generated by Django 2.1.5 on 2019-02-18 16:14 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0027_entry_country_slug'), + ] + + operations = [ + migrations.RemoveField( + model_name='entry', + name='country_name', + ), + migrations.RemoveField( + model_name='entry', + name='country_slug', + ), + migrations.RemoveField( + model_name='entry', + name='location_name', + ), + migrations.RemoveField( + model_name='entry', + name='region_name', + ), + migrations.RemoveField( + model_name='entry', + name='state_name', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0029_home_more_popular.py b/app/unused_apps/jrnl/migrations/0029_home_more_popular.py new file mode 100644 index 0000000..2adc219 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0029_home_more_popular.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.2 on 2019-02-20 11:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0028_auto_20190218_1614'), + ] + + operations = [ + migrations.AddField( + model_name='home', + name='more_popular', + field=models.ManyToManyField(related_name='morepopular', to='jrnl.Entry'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0030_remove_home_popular.py b/app/unused_apps/jrnl/migrations/0030_remove_home_popular.py new file mode 100644 index 0000000..8ac7408 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0030_remove_home_popular.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.2 on 2019-02-20 11:35 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0029_home_more_popular'), + ] + + operations = [ + migrations.RemoveField( + model_name='home', + name='popular', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0031_auto_20190220_1136.py b/app/unused_apps/jrnl/migrations/0031_auto_20190220_1136.py new file mode 100644 index 0000000..621b692 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0031_auto_20190220_1136.py @@ -0,0 +1,22 @@ +# Generated by Django 2.1.2 on 2019-02-20 11:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0030_remove_home_popular'), + ] + + operations = [ + migrations.RemoveField( + model_name='home', + name='more_popular', + ), + migrations.AddField( + model_name='home', + name='popular', + field=models.ManyToManyField(related_name='popular', to='jrnl.Entry'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0032_entry_subtitle.py b/app/unused_apps/jrnl/migrations/0032_entry_subtitle.py new file mode 100644 index 0000000..d5ccc80 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0032_entry_subtitle.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.7 on 2019-02-28 09:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0031_auto_20190220_1136'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='subtitle', + field=models.CharField(blank=True, max_length=200), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0033_entry_field_notes_two.py b/app/unused_apps/jrnl/migrations/0033_entry_field_notes_two.py new file mode 100644 index 0000000..b90e86b --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0033_entry_field_notes_two.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.7 on 2019-03-03 15:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fieldnotes', '0002_auto_20190303_1222'), + ('jrnl', '0032_entry_subtitle'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='field_notes_two', + field=models.ManyToManyField(blank=True, to='fieldnotes.FieldNote'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0034_remove_entry_field_notes.py b/app/unused_apps/jrnl/migrations/0034_remove_entry_field_notes.py new file mode 100644 index 0000000..a0e93b0 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0034_remove_entry_field_notes.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.7 on 2019-03-03 16:10 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0033_entry_field_notes_two'), + ] + + operations = [ + migrations.RemoveField( + model_name='entry', + name='field_notes', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0035_auto_20190303_1610.py b/app/unused_apps/jrnl/migrations/0035_auto_20190303_1610.py new file mode 100644 index 0000000..7b51186 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0035_auto_20190303_1610.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.7 on 2019-03-03 16:10 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0034_remove_entry_field_notes'), + ] + + operations = [ + migrations.RenameField( + model_name='entry', + old_name='field_notes_two', + new_name='field_notes', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0036_enjoyitem.py b/app/unused_apps/jrnl/migrations/0036_enjoyitem.py new file mode 100644 index 0000000..aaa8596 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0036_enjoyitem.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1.7 on 2019-03-14 23:42 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('jrnl', '0035_auto_20190303_1610'), + ] + + operations = [ + migrations.CreateModel( + name='EnjoyItem', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('object_id', models.PositiveIntegerField()), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), + ], + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0037_enjoyitem_entry.py b/app/unused_apps/jrnl/migrations/0037_enjoyitem_entry.py new file mode 100644 index 0000000..733f94c --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0037_enjoyitem_entry.py @@ -0,0 +1,20 @@ +# Generated by Django 2.1.7 on 2019-03-15 00:13 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0036_enjoyitem'), + ] + + operations = [ + migrations.AddField( + model_name='enjoyitem', + name='entry', + field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='jrnl.Entry'), + preserve_default=False, + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0038_remove_enjoyitem_entry.py b/app/unused_apps/jrnl/migrations/0038_remove_enjoyitem_entry.py new file mode 100644 index 0000000..0eec153 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0038_remove_enjoyitem_entry.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.7 on 2019-03-15 00:20 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0037_enjoyitem_entry'), + ] + + operations = [ + migrations.RemoveField( + model_name='enjoyitem', + name='entry', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0039_enjoyitem_order.py b/app/unused_apps/jrnl/migrations/0039_enjoyitem_order.py new file mode 100644 index 0000000..41c5324 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0039_enjoyitem_order.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.7 on 2019-03-15 18:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0038_remove_enjoyitem_entry'), + ] + + operations = [ + migrations.AddField( + model_name='enjoyitem', + name='order', + field=models.IntegerField(default=1), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0040_auto_20190315_1906.py b/app/unused_apps/jrnl/migrations/0040_auto_20190315_1906.py new file mode 100644 index 0000000..9ce813b --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0040_auto_20190315_1906.py @@ -0,0 +1,20 @@ +# Generated by Django 2.1.7 on 2019-03-15 19:06 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0039_enjoyitem_order'), + ] + + operations = [ + migrations.RemoveField( + model_name='enjoyitem', + name='content_type', + ), + migrations.DeleteModel( + name='EnjoyItem', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0041_auto_20190315_2240.py b/app/unused_apps/jrnl/migrations/0041_auto_20190315_2240.py new file mode 100644 index 0000000..06b9697 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0041_auto_20190315_2240.py @@ -0,0 +1,28 @@ +# Generated by Django 2.1.7 on 2019-03-15 22:40 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('jrnl', '0040_auto_20190315_1906'), + ] + + operations = [ + migrations.CreateModel( + name='RelatedPost', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('slug', models.SlugField()), + ('post_model', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='contenttypes.ContentType')), + ], + ), + migrations.AddField( + model_name='entry', + name='related', + field=models.ManyToManyField(blank=True, to='jrnl.RelatedPost'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0042_auto_20190412_1805.py b/app/unused_apps/jrnl/migrations/0042_auto_20190412_1805.py new file mode 100644 index 0000000..71c0d51 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0042_auto_20190412_1805.py @@ -0,0 +1,24 @@ +# Generated by Django 2.1.7 on 2019-04-12 18:05 + +import django.contrib.postgres.indexes +import django.contrib.postgres.search +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0041_auto_20190315_2240'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='search_document', + field=django.contrib.postgres.search.SearchVectorField(null=True), + ), + migrations.AddIndex( + model_name='entry', + index=django.contrib.postgres.indexes.GinIndex(fields=['search_document'], name='jrnl_entry_search__a7a10f_gin'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0043_auto_20190704_0903.py b/app/unused_apps/jrnl/migrations/0043_auto_20190704_0903.py new file mode 100644 index 0000000..758499a --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0043_auto_20190704_0903.py @@ -0,0 +1,21 @@ +# Generated by Django 2.1.7 on 2019-07-04 09:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0042_auto_20190412_1805'), + ] + + operations = [ + migrations.RemoveIndex( + model_name='entry', + name='jrnl_entry_search__a7a10f_gin', + ), + migrations.RemoveField( + model_name='entry', + name='search_document', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0044_auto_20190917_1703.py b/app/unused_apps/jrnl/migrations/0044_auto_20190917_1703.py new file mode 100644 index 0000000..c6e5d6c --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0044_auto_20190917_1703.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.7 on 2019-09-17 17:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('jrnl', '0043_auto_20190704_0903'), + ] + + operations = [ + migrations.RenameModel( + old_name='RelatedPost', + new_name='OldRelatedPost', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0045_entry_books_new.py b/app/unused_apps/jrnl/migrations/0045_entry_books_new.py new file mode 100644 index 0000000..a941088 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0045_entry_books_new.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.6 on 2019-11-10 08:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('books', '0009_book_afflink'), + ('jrnl', '0044_auto_20190917_1703'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='books_new', + field=models.ManyToManyField(blank=True, related_name='luxbooks', to='books.Book'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0046_remove_entry_books.py b/app/unused_apps/jrnl/migrations/0046_remove_entry_books.py new file mode 100644 index 0000000..bad9813 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0046_remove_entry_books.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.6 on 2019-11-10 08:57 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0045_entry_books_new'), + ] + + operations = [ + migrations.RemoveField( + model_name='entry', + name='books', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0047_auto_20191110_0859.py b/app/unused_apps/jrnl/migrations/0047_auto_20191110_0859.py new file mode 100644 index 0000000..28d3866 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0047_auto_20191110_0859.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.6 on 2019-11-10 08:59 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0046_remove_entry_books'), + ] + + operations = [ + migrations.RenameField( + model_name='entry', + old_name='books_new', + new_name='books', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0048_auto_20191205_1720.py b/app/unused_apps/jrnl/migrations/0048_auto_20191205_1720.py new file mode 100644 index 0000000..51be2f1 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0048_auto_20191205_1720.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.6 on 2019-12-05 17:20 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0047_auto_20191110_0859'), + ] + + operations = [ + migrations.RenameField( + model_name='entry', + old_name='related', + new_name='oldrelated', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0049_entry_newrelated.py b/app/unused_apps/jrnl/migrations/0049_entry_newrelated.py new file mode 100644 index 0000000..3bd8dee --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0049_entry_newrelated.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.6 on 2019-12-05 17:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('normalize', '0001_initial'), + ('jrnl', '0048_auto_20191205_1720'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='newrelated', + field=models.ManyToManyField(blank=True, to='normalize.RelatedPost'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0050_auto_20191206_0741.py b/app/unused_apps/jrnl/migrations/0050_auto_20191206_0741.py new file mode 100644 index 0000000..b732b68 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0050_auto_20191206_0741.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.6 on 2019-12-06 07:41 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0049_entry_newrelated'), + ] + + operations = [ + migrations.RenameField( + model_name='entry', + old_name='newrelated', + new_name='related', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0051_auto_20201027_2102.py b/app/unused_apps/jrnl/migrations/0051_auto_20201027_2102.py new file mode 100644 index 0000000..09d0dea --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0051_auto_20201027_2102.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1 on 2020-10-27 21:02 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0050_auto_20191206_0741'), + ] + + operations = [ + migrations.RenameField( + model_name='entry', + old_name='field_notes', + new_name='old_field_notes', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0052_entry_new_field_notes.py b/app/unused_apps/jrnl/migrations/0052_entry_new_field_notes.py new file mode 100644 index 0000000..3ec3167 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0052_entry_new_field_notes.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1 on 2020-10-27 21:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('posts', '0011_remove_post_jrnl'), + ('jrnl', '0051_auto_20201027_2102'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='new_field_notes', + field=models.ManyToManyField(blank=True, to='posts.Post'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0053_auto_20201027_2105.py b/app/unused_apps/jrnl/migrations/0053_auto_20201027_2105.py new file mode 100644 index 0000000..904b6c2 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0053_auto_20201027_2105.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1 on 2020-10-27 21:05 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0052_entry_new_field_notes'), + ] + + operations = [ + migrations.RenameField( + model_name='entry', + old_name='new_field_notes', + new_name='field_notes', + ), + ] diff --git a/app/unused_apps/jrnl/migrations/0054_auto_20201111_2148.py b/app/unused_apps/jrnl/migrations/0054_auto_20201111_2148.py new file mode 100644 index 0000000..bdeb63f --- /dev/null +++ b/app/unused_apps/jrnl/migrations/0054_auto_20201111_2148.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1 on 2020-11-11 21:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('posts', '0012_remove_post_field_notes'), + ('jrnl', '0053_auto_20201027_2105'), + ] + + operations = [ + migrations.RemoveField( + model_name='entry', + name='old_field_notes', + ), + migrations.AlterField( + model_name='entry', + name='field_notes', + field=models.ManyToManyField(blank=True, limit_choices_to={'post_type': 5}, to='posts.Post'), + ), + ] diff --git a/app/unused_apps/jrnl/migrations/__init__.py b/app/unused_apps/jrnl/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/unused_apps/jrnl/migrations/__init__.py diff --git a/app/unused_apps/jrnl/models.py b/app/unused_apps/jrnl/models.py new file mode 100644 index 0000000..f3c0626 --- /dev/null +++ b/app/unused_apps/jrnl/models.py @@ -0,0 +1,309 @@ +import datetime +import os + +from django.dispatch import receiver +from django.contrib.gis.db import models +from django.db.models.signals import post_save +from django.contrib.contenttypes.fields import GenericRelation, GenericForeignKey +from django.contrib.contenttypes.models import ContentType +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 +from django import forms + +import urllib.request +import urllib.parse +import urllib.error +from django_gravatar.helpers import get_gravatar_url, has_gravatar, calculate_gravatar_hash +from django_comments.signals import comment_was_posted +from django_comments.models import Comment +from django_comments.moderation import CommentModerator, moderator + +from photos.models import PhotoGallery, LuxImage, LuxImageSize +from locations.models import Location +from books.models import Book +from posts.models import Post +from normalize.models import RelatedPost + +from utils.util import render_images, parse_video, markdown_to_html + + +def get_upload_path(self, filename): + return "images/post-images/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename) + + +def image_url_replace(s): + s = s.replace('[[base_url]]', settings.IMAGES_URL) + return s + + +class OldRelatedPost(models.Model): + post_model = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL) + slug = models.SlugField() + + def __str__(self): + return self.slug + + +class Entry(models.Model): + title = models.CharField(max_length=200) + subtitle = models.CharField(max_length=200, blank=True) + slug = models.SlugField(unique_for_date='pub_date') + body_html = models.TextField(blank=True) + body_markdown = models.TextField() + dek = models.TextField(null=True, blank=True) + pub_date = models.DateTimeField('Date published') + 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) + PUB_STATUS = ( + (0, 'Draft'), + (1, 'Published'), + ) + status = models.IntegerField(choices=PUB_STATUS, default=0) + photo_gallery = models.ForeignKey(PhotoGallery, on_delete=models.CASCADE, blank=True, null=True, verbose_name='photo set') + image = models.FileField(upload_to=get_upload_path, blank=True, help_text="should be 520 by 290") + meta_description = models.CharField(max_length=256, null=True, blank=True) + TEMPLATES = ( + (0, 'single'), + (1, 'double'), + (2, 'single-dark'), + (3, 'double-dark'), + (4, 'single-black'), + (5, 'double-black'), + ) + template_name = models.IntegerField(choices=TEMPLATES, default=0) + featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) + has_video = models.BooleanField(blank=True, default=False) + #old_field_notes = models.ManyToManyField(FieldNote, blank=True) + field_notes = models.ManyToManyField(Post, blank=True, limit_choices_to={'post_type': 5}) + books = models.ManyToManyField(Book, related_name="luxbooks", blank=True) + oldrelated = models.ManyToManyField(OldRelatedPost, blank=True) + related = models.ManyToManyField(RelatedPost, blank=True) + + class Meta: + ordering = ('-pub_date',) + get_latest_by = 'pub_date' + verbose_name_plural = 'entries' + + def __str__(self): + return self.title + + def get_absolute_url(self): + # return "/jrnl/%s/%s" % (self.pub_date.strftime("%Y/%m").lower(), self.slug) + return reverse("jrnl:detail", kwargs={"year": self.pub_date.year, "month": self.pub_date.strftime("%m"), "slug": self.slug}) + + def get_absolute_url_old(self): + return "/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d").lower(), self.slug) + + def comment_period_open(self): + return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date + + def get_thumbnail_url(self): + image_dir, img = self.image.url.split('post-thumbnail/')[1].split('/') + return '%spost-thumbnail/%s/%s' % (settings.IMAGES_URL, image_dir, img) + + def get_image_url(self): + try: + image_dir, img = self.image.url.split('post-images/')[1].split('/') + return '%spost-images/%s/%s' % (settings.IMAGES_URL, image_dir, img) + except ValueError: + pass + + def get_image_wide_url(self): + img = self.image.url.split('post-images/')[1].split('/')[1] + # return '%shome-images/%s' % (settings.IMAGES_URL, img) + return '%shome-images/%s' % (settings.IMAGES_URL, img) + + def get_image_hero_url(self): + img = self.image.url.split('post-images/')[1].split('/')[1] + return '/media/images/home-images/hero%s' % (img) + + def get_image_hero_url_sm(self): + img = self.image.url.split('post-images/')[1].split('/')[1] + img = os.path.splitext(img)[0] + return '/media/images/home-images/hero%s_sm.jpg' % (img) + + def get_featured_image(self): + if self.featured_image: + return "%s%s" % (settings.IMAGES_URL, self.featured_image.image.url[14:]) + else: + return self.image.url + + def get_featured_image_thumb(self): + if self.featured_image: + return self.featured_image.get_image_by_size("tn") + else: + 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 longitude(self): + '''Get the site's longitude.''' + return self.point.x + + @property + def latitude(self): + '''Get the site's latitude.''' + return self.point.y + + @property + def get_previous_published(self): + return self.get_previous_by_pub_date(status__exact=1) + + @property + def get_previous_admin_url(self): + n = self.get_previous_by_pub_date() + return reverse('admin:%s_%s_change' %(self._meta.app_label, self._meta.model_name), args=[n.id] ) + + @property + def get_next_published(self): + return self.get_next_by_pub_date(status__exact=1) + + @property + def get_next_admin_url(self): + model = apps.get_model(app_label=self._meta.app_label, model_name=self._meta.model_name) + try: + return reverse('admin:%s_%s_change' %(self._meta.app_label, self._meta.model_name), args=[self.get_next_by_pub_date().pk] ) + except model.DoesNotExist: + return '' + + def get_image_name(self): + return self.image.url.split("post-images/")[1][5:-4] + + def get_image_ext(self): + return self.image.url[-3:] + + def get_content_type(self): + return ContentType.objects.get(app_label="jrnl", model="entry") + + def save(self, *args, **kwargs): + created = self.pk is None + if not created: + md = render_images(self.body_markdown) + self.body_html = markdown_to_html(md) + self.has_video = parse_video(self.body_html) + 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)) + 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 + if old and old.featured_image != self.featured_image: # Field has changed + s = LuxImageSize.objects.get(name="featured_jrnl") + ss = LuxImageSize.objects.get(name="picwide-med") + self.featured_image.sizes.add(s) + self.featured_image.sizes.add(ss) + self.featured_image.save() + if old and old.title != self.title or old and old.slug != self.slug: + related, c = RelatedPost.objects.get_or_create(model_name=self.get_content_type(), entry_id = self.id, pub_date=self.pub_date) + related.title = self.title + related.slug = self.slug + related.save() + + super(Entry, self).save(*args, **kwargs) + + +class HomepageCurrator(models.Model): + """ + simple model to control the featured article on the homepage + also allows me to fudge the "popular" section to be what I want + """ + image_offset_vertical = models.CharField(max_length=20, help_text="add negative top margin to shift image (include css unit)") + images = models.ManyToManyField(LuxImage) + #featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) + tag_line = models.CharField(max_length=200) + featured = models.ForeignKey(Entry, on_delete=models.CASCADE, related_name="oldbanner") + popular = models.ManyToManyField(Entry) + template_name = models.CharField(max_length=200, help_text="full path") + + +class Home(models.Model): + """ + simple model to control the featured article on the homepage + also allows me to fudge the "popular" section to be what I want + """ + image_offset_vertical = models.CharField(max_length=20, help_text="add negative top margin to shift image (include css unit)") + featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) + tag_line = models.CharField(max_length=200) + featured = models.ForeignKey(Entry, on_delete=models.CASCADE, related_name="banner") + popular = models.ManyToManyField(Entry, related_name="popular") + template_name = models.CharField(max_length=200, help_text="full path") + + +class BlogSitemap(Sitemap): + changefreq = "never" + priority = 1.0 + protocol = "https" + + def items(self): + return Entry.objects.filter(status=1) + + def lastmod(self, obj): + return obj.pub_date + + +class EntryModerator(CommentModerator): + ''' + Moderate everything except people with multiple approvals + ''' + email_notification = True + + def moderate(self, comment, content_object, request): + previous_approvals = Comment.objects.filter(user_email=comment.email, is_public=True) + for approval in previous_approvals: + if approval.submit_date <= datetime.datetime.today() - datetime.timedelta(21): + approve = True + if previous_approvals.count() > 2 and approve: + return False + # do entry build right here so it goes to live site + return True + + +moderator.register(Entry, EntryModerator) + + +@receiver(comment_was_posted, sender=Comment) +def cache_gravatar(sender, comment, **kwargs): + gravatar_exists = has_gravatar(comment.email) + grav_dir = settings.IMAGES_ROOT + '/gravcache/' + if gravatar_exists: + url = get_gravatar_url(comment.email, size=60) + if not os.path.isdir(grav_dir): + os.makedirs(grav_dir) + local_grav = '%s/%s.jpg' % (grav_dir, calculate_gravatar_hash(comment.email)) + urllib.request.urlretrieve(url, local_grav) + + +@receiver(post_save, sender=Entry) +def post_save_events(sender, update_fields, created, instance, **kwargs): + """ + Creates a generic related entry when a new post is added + """ + if created: + related, c = RelatedPost.objects.get_or_create(model_name=instance.get_content_type(), entry_id = instance.id, pub_date=instance.pub_date, title=instance.title, slug=instance.slug) + +# from django_comments.signals import comment_will_be_posted +# from django_comments import akismet + + +# @receiver(comment_will_be_posted, sender=Comment) +# def spam_check(sender, comment, request, **kwargs): +# akismet.USERAGENT = "David Lynch's Python library/1.0" +# try: +# real_key = akismet.verify_key(settings.AKISMET_KEY, "https://luxagraf.net/") +# if real_key: +# is_spam = akismet.comment_check(settings.AKISMET_KEY, "https://luxagraf.net/", request.META['REMOTE_ADDR'], request.META['HTTP_USER_AGENT'], comment_content=comment.comment) +# if is_spam: +# return False +# else: +# return True +# except akismet.AkismetError as e: +# print('Something went wrong, allowing comment') +# print(e.response, e.statuscode) +# return True diff --git a/app/unused_apps/jrnl/templates/horizontal_select.html b/app/unused_apps/jrnl/templates/horizontal_select.html new file mode 100644 index 0000000..61dcfd8 --- /dev/null +++ b/app/unused_apps/jrnl/templates/horizontal_select.html @@ -0,0 +1,17 @@ +{% with id=widget.attrs.id %} + <ul{% if id %} id="{{ id }}"{% endif %}{% if widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}> + {% for group, options, index in widget.optgroups %} + {% if group %} + <li>{{ group }} + <ul{% if id %} id="{{ id }}_{{ index }}"{% endif %}> + {% endif %} + {% for option in options %} + <li data-imageid="{{option.value}}" data-loopcounter="{{forloop.parentloop.counter}}">{% include option.template_name with widget=option %}</li> + {% endfor %} + {% if group %} + </ul> + </li> + {% endif %} + {% endfor %} + </ul> +{% endwith %} diff --git a/app/unused_apps/jrnl/templates/jrnl/entry_detail.html b/app/unused_apps/jrnl/templates/jrnl/entry_detail.html new file mode 100644 index 0000000..0904178 --- /dev/null +++ b/app/unused_apps/jrnl/templates/jrnl/entry_detail.html @@ -0,0 +1,240 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load comments %} + +{% block pagetitle %}{{object.title|title|smartypants|safe}} - by Scott Gilbertson{% endblock %} + +{% block metadescription %}{% autoescape on %}{{object.meta_description|striptags|safe}}{% endautoescape %}{% endblock %} +{%block extrahead%} + <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.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.state.name}}{%else%}{{object.location.name|smartypants|safe}}, {{object.location.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}}" /> + <meta property="og:url" content="https://luxagraf.net{{object.get_absolute_url}}" /> + <meta property="og:description" content="{{object.meta_description}}" /> + <meta property="article:published_time" content="{{object.pub_date|date:'c'}}" /> + <meta property="article:author" content="Scott Gilbertson" /> + <meta property="og:site_name" content="Luxagraf" /> + <meta property="og:image" content="{{object.get_featured_image}}" /> + <meta property="og:locale" content="en_US" /> + <meta name="twitter:card" content="summary_large_image"/> + <meta name="twitter:description" content="{{object.meta_description}}"/> + <meta name="twitter:title" content="{{object.title|safe}}"/> + <meta name="twitter:site" content="@luxagraf"/> + <meta name="twitter:domain" content="luxagraf"/> + <meta name="twitter:image:src" content="{{object.get_featured_image}}"/> + <meta name="twitter:creator" content="@luxagraf"/> +<script type="application/ld+json"> +{ + "@context": "https://schema.org", + "@type": "Article", + "mainEntityOfPage": { + "@type": "WebPage", + "@id": "https://luxagraf.net{{object.get_absolute_url}}" + }, + "headline": "{{object.title}}", + "datePublished": "{{object.pub_date|date:'c'}}+04:00", + "dateModified": "{{object.pub_date|date:'c'}}+04:00", + "author": { + "@type": "Person", + "name": "Scott Gilbertson" + }, + "publisher": { + "@type": "Organization", + "name": "Luxagraf", + "logo": { + "@type": "ImageObject", + "url": "https://luxagraf.net/media/img/logo-white.jpg" + } + }, + "description": "{{object.meta_description}}" +} +</script> +{%endblock%} +{%block htmlclass%}{% with object.template_name as t %} +class="detail {%if t == 1 or t == 3 or t == 5 %}double{%else%}single{%endif%}{%if t == 2 or t == 3 %} dark{%endif%}{%if t == 4 or t == 5 %} black{%endif%}"{%endwith%}{%endblock%} + + {% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} +{% block primary %} + <main> + <article class="h-entry hentry entry-content content{% with object.get_template_name_display as t %}{%if t == "double" or t == "double-dark" %} post--article--double{%endif%}{%endwith%}" itemscope itemType="http://schema.org/BlogPosting"> + <header id="header" class="post-header {% with object.get_template_name_display as t %}{%if t == "double" or t == "double-dark" %}post--header--double{%endif%}{%endwith%}"> + <h1 class="p-name entry-title post-title" itemprop="headline">{%if object.template_name == 1 or object.template_name == 3 %}{{object.title|smartypants|safe}}{%else%}{{object.title|smartypants|safe}}{%endif%}</h1> + {% if object.subtitle %}<h2 class="post-subtitle">{{object.subtitle|smartypants|safe}}</h2>{%endif%} + <div class="post-linewrapper"> + {% if object.location %}<div class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> + <h3 class="h-adr" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">{% if object.location.country_name == "United States" %}<span class="p-locality locality" itemprop="addressLocality">{{object.location.name|smartypants|safe}}</span>, <a class="p-region region" href="/jrnl/united-states/" title="travel writing from the United States">{{object.location.state_name|safe}}</a>, <span class="p-country-name" itemprop="addressCountry">U.S.</span>{%else%}<span class="p-region" itemprop="addressRegion">{{object.location.name|smartypants|safe}}</span>, <a class="p-country-name country-name" href="/jrnl/{{object.location.country_slug}}/" title="travel writing from {{object.location.country_name}}"><span itemprop="addressCountry">{{object.location.country_name|safe}}</span></a>{%endif%}</h3> + – <a href="" onclick="showMap({{object.latitude}}, {{object.longitude}}, { type:'point', lat:'{{object.latitude}}', lon:'{{object.longitude}}'}); return false;" title="see a map">Map</a> + </div>{%endif%} + <time class="dt-published published dt-updated post-date" datetime="{{object.pub_date|date:'c'}}" itemprop="datePublished">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time> + <span class="hide" itemprop="author" itemscope itemtype="http://schema.org/Person">by <a class="p-author h-card" href="/about"><span itemprop="name">Scott Gilbertson</span></a></span> + </div> + </header> + <div id="article" class="e-content entry-content post--body post--body--{% with object.template_name as t %}{%if t == 0 or t == 2 %}single{%endif%}{%if t == 1 or t == 3 %}double{%endif%}{%endwith%}" itemprop="articleBody"> + {{object.body_html|safe|smartypants}} + </div> + {%if wildlife or object.field_notes.all or object.books.all %}<div class="entry-footer">{%if wildlife %} + <aside id="wildlife"> + <h3>Fauna and Flora</h3> + {% regroup wildlife by ap.apclass.get_kind_display as wildlife_list %} + <ul> + {% for object_list in wildlife_list %} + <li class="grouper">{{object_list.grouper}}<ul> + {% for object in object_list.list %} + <li>{%if object.ap.body_markdown%}<a href="{% url 'sightings:detail' object.ap.slug %}">{{object}}</a>{%else%}{{object}}{%endif%} </li> + {% endfor %}</ul> + {% endfor %}</ul> + </aside> + {% endif %}{%if object.field_notes.all %} + <aside {% if wildlife %}class="margin-left-none" {%endif%}id="field_notes"> + <h3>Field Notes</h3> + <ul>{% for obj in object.field_notes.all %} + <li><a href="{% url 'fieldnotes:detail' year=obj.pub_date.year month=obj.pub_date|date:"m" slug=obj.slug %}">{{obj}}</a></li> + {% endfor %}</ul> + </aside>{% endif %} + {%if object.books.all %} + <aside id="recommended-reading" {%if object.field_notes.all and wildlife %}class="rr-clear{%endif%}" > + <h3>Recommended Reading</h3> + <ul>{% for obj in object.books.all %} + <li><a href="{% url 'books:detail' slug=obj.slug %}"><img src="{{obj.get_small_image_url}}" /></a></li> + {% endfor %}</ul> + </aside>{% endif %} + </div>{%endif%} + </article> + {% with object.get_next_published as next %} + {% with object.get_previous_published as prev %} + <div class="nav-wrapper"> + <nav id="page-navigation" {%if wildlife or object.field_notes.all or object.books.all %}{%else%}class="page-border-top"{%endif%}> + <ul>{% if prev%} + <li id="prev"><span class="bl">Previous:</span> + <a href="{{ prev.get_absolute_url }}" rel="prev" title=" {{prev.title}}">{{prev.title|safe}}</a> + </li>{%endif%}{% if next%} + <li id="next"><span class="bl">Next:</span> + <a href="{{ next.get_absolute_url }}" rel="next" title=" {{next.title}}">{{next.title|safe}}</a> + </li>{%endif%} + </ul> + </nav>{%endwith%}{%endwith%} + </div> + {% if object.related.all %}<div class="article-afterward related"> + <div class="related-bottom"> + <h6 class="hedtinycaps">You might also enjoy</h6> + <ul class="article-card-list">{% for object in related %} + <li class="article-card-mini"><a href="{{object.get_absolute_url}}" title="{{object.title}}"> + <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> + <p class="post-summary"> + <span class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> + {% if object.location.country_name == "United States" %}{{object.location.state_name}}{%else%}{{object.location.country_name}}{%endif%} + </span> + – + <time class="dt-published published dt-updated post-date" datetime="{{object.pub_date|date:'c'}}"><span>{{object.pub_date|date:" Y"}}</span></time> + </p> + </a> + </li> + {% endfor %}</ul> + </div> + </div>{%endif%} + + {% comment %} <div class="mailing-list--wrapper"> + <h5>If you enjoyed this, you should join the mailing list…</h5> + {% include 'mailing_list.html' %} + </div> {% endcomment %} + {% if object.enable_comments %} +{% get_comment_count for object as comment_count %} +{%if comment_count > 0 %} +<p class="comments--header">{{comment_count}} Comment{{ comment_count|pluralize }}</p> +{% render_comment_list for object %} +{%endif%} +<div class="comment--form--wrapper {%if comment_count > 0%}comment-form-border{%endif%}"> +{% render_comment_form for object %} +</div> +{% else %} +<p class="comments--header" style="text-align: center">Sorry, comments have been disabled for this post.</p> +{%endif%} +</main> +{% endblock %} +{% block js %} +<script> +document.addEventListener("DOMContentLoaded", function(event) { + var leaflet = document.createElement('script'); + leaflet.src = "/media/js/leaflet-master/leaflet-mod.js"; + document.body.appendChild(leaflet); + var lightbox = document.createElement('script'); + lightbox.src = "/media/js/lightbox.js"; + document.body.appendChild(lightbox); + leaflet.onload = function(){ + var detail = document.createElement('script'); + detail.src = "/media/js/detail.min.js"; + document.body.appendChild(detail); + {% with object.get_template_name_display as t %}{%if t == "single" or t == "single-dark" %} + detail.onload = function(){ + createMap(); + var open = false; + } + {%endif%}{%endwith%} + } + + lightbox.onload = function() { + var opts= { + //nextOnClick: false, + captions: true, + onload: function(){ + var im = document.getElementById("jslghtbx-contentwrapper"); + var link = im.appendChild(document.createElement('a')) + link.href = im.firstChild.src; + link.innerHTML= "open "; + link.target = "_blank"; + link.setAttribute('class', 'p-link'); + im.appendChild(link); + } + }; + var lightbox = new Lightbox(); + lightbox.load(opts); + } + {% if object.enable_comments %} +{% get_comment_count for object as comment_count %} +{%if comment_count > 0 %} + //delay loading of gravatar images using noscript data-hash attribute + dataattr = document.getElementsByClassName("datahashloader"); + for(var i=0; i<dataattr.length; i++) { + var c = dataattr[i].parentNode; + var img = document.createElement("img"); + img.src = 'https://images.luxagraf.net/gravcache/' + dataattr[i].getAttribute('data-hash') + '.jpg'; + img.className += "gravatar"; + img.alt = "gravatar icon"; + c.insertBefore(img, c.childNodes[3]); + } +{%endif%} +{%endif%} +{% if object.has_video %} +var tester = document.getElementsByClassName("vidauto"); +var wrapper = document.getElementById('wrapper'); +var dist = 100; + +window.onscroll = function() { + for (var i=0; i<tester.length; i++) { + checkVisible(tester[i]) ? tester[i].play() : tester[i].pause(); + } +}; + +function checkVisible(elm) { + var rect = elm.getBoundingClientRect(); + var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight); + return !(rect.bottom < 0 || rect.top - viewHeight >= 0); +} +{%endif%} + +}); +</script> +{%endblock%} diff --git a/app/unused_apps/jrnl/templates/jrnl/entry_detail.txt b/app/unused_apps/jrnl/templates/jrnl/entry_detail.txt new file mode 100644 index 0000000..547ce79 --- /dev/null +++ b/app/unused_apps/jrnl/templates/jrnl/entry_detail.txt @@ -0,0 +1,8 @@ +{{object.title|safe}} +{% for letter in object.title %}={%endfor%} + + by Scott Gilbertson + <{{SITE_URL}}{{object.get_absolute_url}}> + {{object.pub_date|date:"l, d F Y"}} + +{{object.body_markdown|safe}} diff --git a/app/unused_apps/jrnl/templates/jrnl/entry_list.html b/app/unused_apps/jrnl/templates/jrnl/entry_list.html new file mode 100644 index 0000000..6eefe10 --- /dev/null +++ b/app/unused_apps/jrnl/templates/jrnl/entry_list.html @@ -0,0 +1,33 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% 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 %} +{% block metadescription %}{% if region %}Travel writing, essays and dispatches from {{region.name|title|smartypants|safe}}{%else%}Travel writing, essays and dispatches from around the world{%endif%} Page {{page}}{% endblock %} +{%block bodyid%}id="writing" class="archive"{%endblock%} +{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} +{% block primary %}<main class="archive-grid"> + <h1 class="hide">{% if region %}Journal entries from {%if region.name == 'United States'%}the United States{%else%}{{region.name|title|smartypants|safe}}{%endif%}{%else%}Journal {%endif%}</h1>{% autopaginate object_list 24 %} {% for object in object_list %} + <article class="h-entry hentry archive-card {% cycle 'odd' 'even' %} {% cycle 'first' 'second' 'third' %}" itemscope itemType="http://schema.org/Article"> + <div class="post-image"> + <a href="{{object.get_absolute_url}}" title="{{object.title}}">{% if object.featured_image %} + {% include "lib/img_archive.html" with image=object.featured_image %} + {%else%} + <img src="{{object.get_image_url}}" alt="{{ object.title }}" class="u-photo post-image" itemprop="image" />{%endif%}</a> + </div> + <h2 class="p-name entry-title post-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|widont}}</a></h2> + <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> + <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.location.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.location.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.location.country_slug}}/" title="travel writing from {{object.location.country_name}}">{{object.location.country_name}}</a>{%endif%} + </span> – + <span class="p-summary" itemprop="description"> + {{object.dek|safe}} + </span> + </p> + </article> {% endfor %} + </main> + <nav aria-label="page navigation" class="pagination"> + {% paginate %} + </nav> +{% endblock %} diff --git a/app/unused_apps/jrnl/urls.py b/app/unused_apps/jrnl/urls.py new file mode 100644 index 0000000..caf1935 --- /dev/null +++ b/app/unused_apps/jrnl/urls.py @@ -0,0 +1,61 @@ +from django.urls import path, re_path +from django.views.generic.base import RedirectView + +from . import views + +app_name = "jrnl" + +urlpatterns = [ + path( + r'feed.xml', + views.JrnlRSSFeedView(), + name="feed" + ), + re_path( + r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+).txt$', + views.EntryDetailViewTXT.as_view(), + name="detail-txt" + ), + re_path( + r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+)$', + views.EntryDetailView.as_view(), + name="detail" + ), + re_path( + r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', + views.EntryMonthArchiveView.as_view(month_format='%m'), + name="list_month" + ), + re_path( + r'(?P<year>\d{4})/$', + views.EntryYearArchiveView.as_view(), + name="list_year" + ), + re_path( + r'^(?P<page>\d+)/$', + views.EntryList.as_view(), + name="list" + ), + path( + r'latest/', + views.JrnlLatestView.as_view(), + name="latest" + ), + re_path( + r'(?P<slug>[-\w]+)/(?P<page>\d+)/$', + views.EntryCountryList.as_view(), + name="list_country" + ), + re_path( + r'^(?P<slug>[-\w]+)/$', + views.EntryCountryList.as_view(), + {'page':1}, + name="list_country" + ), + re_path( + r'', + views.EntryList.as_view(), + {'page':1}, + name="list" + ), +] diff --git a/app/unused_apps/jrnl/views.py b/app/unused_apps/jrnl/views.py new file mode 100644 index 0000000..6b7cc8d --- /dev/null +++ b/app/unused_apps/jrnl/views.py @@ -0,0 +1,165 @@ +from django.views.generic import ListView +from django.views.generic.detail import DetailView +from django.views.generic.dates import DateDetailView +from django.urls import reverse +from django.views.generic.dates import YearArchiveView, MonthArchiveView +from django.contrib.syndication.views import Feed +from django.apps import apps +from django.shortcuts import get_object_or_404 +from django.conf import settings +from django.db.models import Q + +from utils.views import PaginatedListView + +from .models import Entry, HomepageCurrator, Home +from locations.models import LuxCheckIn, Country, Region, Location +from sightings.models import Sighting + + +class EntryList(PaginatedListView): + """ + Return a list of Entries in reverse chronological order + """ + model = Entry + + def get_queryset(self): + queryset = super(EntryList, self).get_queryset() + print(queryset) + return queryset.filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image') + + +class EntryCountryList(PaginatedListView): + """ + Return a list of Entries by Country in reverse chronological order + """ + model = Entry + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(EntryCountryList, self).get_context_data(**kwargs) + try: + context['region'] = Country.objects.get(slug__exact=self.kwargs['slug']) + except: + context['region'] = Region.objects.get(slug__exact=self.kwargs['slug']) + return context + + def get_queryset(self): + try: + region = Country.objects.get(slug__exact=self.kwargs['slug']) + qs = Entry.objects.filter( + status__exact=1, + location__state__country=region + ).order_by('-pub_date') + except: + region = Region.objects.get(slug__exact=self.kwargs['slug']) + qs = Entry.objects.filter( + status__exact=1, + location__state__country__lux_region=region.id + ).order_by('-pub_date') + return qs + + +class EntryYearArchiveView(YearArchiveView): + queryset = Entry.objects.filter(status__exact=1).select_related() + date_field = "pub_date" + make_object_list = True + allow_future = True + template_name = "archives/writing_date.html" + + +class EntryMonthArchiveView(MonthArchiveView): + queryset = Entry.objects.filter(status__exact=1).select_related() + date_field = "pub_date" + allow_future = True + template_name = "archives/writing_date.html" + + +class EntryDetailView(DateDetailView): + model = Entry + date_field = 'pub_date' + slug_field = "slug" + + 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 = get_object_or_404( + self.model, + slug=self.kwargs['slug'], + pub_date__month=self.kwargs['month'], + pub_date__year=self.kwargs['year'] + ) + 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.location) | + Q(location__in=Location.objects.filter(parent=self.location)) + ).select_related().order_by('ap_id', 'ap__apclass__kind').distinct("ap") + related = [] + for obj in self.object.related.all(): + model = apps.get_model(obj.model_name.app_label, obj.model_name.model) + related.append(model.objects.get(slug=obj.slug, pub_date=obj.pub_date)) + context['related'] = related + context['breadcrumbs'] = ("jrnl",) + context['crumb_url'] = reverse('jrnl:list') + return context + + +class EntryDetailViewTXT(EntryDetailView): + template_name = "jrnl/entry_detail.txt" + + +class HomepageList(ListView): + """ + Return a main entry and list of Entries in reverse chronological order + """ + 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')[1:9] + + def get_template_names(self): + 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'] = self.home + context['location'] = LuxCheckIn.objects.latest() + context['IMAGES_URL'] = settings.IMAGES_URL + return context + + +class JrnlLatestView(EntryDetailView): + template_name = "details/entry_latest.html" + + def get_object(self, queryset=None): + obj = self.model.objects.filter(status=1).latest() + self.location = obj.location + return obj + + +class JrnlRSSFeedView(Feed): + title = "Luxagraf: Topographical Writings" + link = "/jrnl/" + description = "Latest postings to luxagraf.net" + description_template = 'feeds/blog_description.html' + + def items(self): + return Entry.objects.filter(status__exact=1).order_by('-pub_date')[:10] + + def item_pubdate(self, item): + """ + Takes an item, as returned by items(), and returns the item's + pubdate. + """ + return item.pub_date |