From 7509da286bccd1dda358507cd455f9297db59247 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sun, 15 Nov 2020 10:13:08 -0500 Subject: ported jrnl building to posts --- app/builder/views.py | 82 +++--- app/fieldnotes/__init__.py | 0 app/fieldnotes/admin.py | 38 --- app/fieldnotes/build.py | 36 --- app/fieldnotes/migrations/0001_initial.py | 37 --- .../migrations/0002_auto_20190303_1222.py | 25 -- app/fieldnotes/migrations/__init__.py | 0 app/fieldnotes/models.py | 113 -------- .../fieldnotes/fieldnote_archive_list_date.html | 43 --- .../templates/fieldnotes/fieldnote_detail.html | 95 ------- .../templates/fieldnotes/fieldnote_list.html | 49 ---- app/fieldnotes/urls.py | 39 --- app/fieldnotes/views.py | 37 --- app/jrnl/__init__.py | 0 app/jrnl/admin.py | 129 --------- app/jrnl/build.py | 100 ------- app/jrnl/export.py | 20 -- app/jrnl/fields.py | 7 - app/jrnl/migrations/0001_initial.py | 75 ----- .../0001_squashed_0019_remove_entry_thumbnail.py | 81 ------ app/jrnl/migrations/0002_entrytitlesong.py | 32 --- app/jrnl/migrations/0003_auto_20160309_1018.py | 31 --- app/jrnl/migrations/0004_auto_20160309_1031.py | 30 -- app/jrnl/migrations/0005_auto_20160514_2151.py | 20 -- app/jrnl/migrations/0006_auto_20160715_0703.py | 37 --- app/jrnl/migrations/0007_delete_postimage.py | 18 -- app/jrnl/migrations/0008_auto_20160906_0845.py | 33 --- .../0009_homepagecurrator_image_offset_vertical.py | 21 -- app/jrnl/migrations/0010_auto_20161102_0916.py | 22 -- app/jrnl/migrations/0011_auto_20161102_0925.py | 22 -- app/jrnl/migrations/0012_auto_20161102_0930.py | 30 -- app/jrnl/migrations/0013_entry_featured_image.py | 22 -- app/jrnl/migrations/0014_homepagecurrator.py | 29 -- app/jrnl/migrations/0015_entry_has_video.py | 21 -- app/jrnl/migrations/0016_auto_20161219_1058.py | 21 -- app/jrnl/migrations/0017_entry_field_notes.py | 13 - app/jrnl/migrations/0018_auto_20180303_1037.py | 24 -- app/jrnl/migrations/0019_remove_entry_thumbnail.py | 13 - app/jrnl/migrations/0020_auto_20180606_1058.py | 19 -- app/jrnl/migrations/0021_auto_20180606_1058.py | 19 -- app/jrnl/migrations/0022_auto_20180707_0958.py | 19 -- app/jrnl/migrations/0023_auto_20180902_1210.py | 18 -- app/jrnl/migrations/0024_auto_20180902_1217.py | 32 --- app/jrnl/migrations/0025_auto_20190131_2335.py | 28 -- app/jrnl/migrations/0026_entry_country_name.py | 18 -- app/jrnl/migrations/0027_entry_country_slug.py | 18 -- app/jrnl/migrations/0028_auto_20190218_1614.py | 33 --- app/jrnl/migrations/0029_home_more_popular.py | 18 -- app/jrnl/migrations/0030_remove_home_popular.py | 17 -- app/jrnl/migrations/0031_auto_20190220_1136.py | 22 -- app/jrnl/migrations/0032_entry_subtitle.py | 18 -- app/jrnl/migrations/0033_entry_field_notes_two.py | 19 -- .../migrations/0034_remove_entry_field_notes.py | 17 -- app/jrnl/migrations/0035_auto_20190303_1610.py | 18 -- app/jrnl/migrations/0036_enjoyitem.py | 23 -- app/jrnl/migrations/0037_enjoyitem_entry.py | 20 -- app/jrnl/migrations/0038_remove_enjoyitem_entry.py | 17 -- app/jrnl/migrations/0039_enjoyitem_order.py | 18 -- app/jrnl/migrations/0040_auto_20190315_1906.py | 20 -- app/jrnl/migrations/0041_auto_20190315_2240.py | 28 -- app/jrnl/migrations/0042_auto_20190412_1805.py | 24 -- app/jrnl/migrations/0043_auto_20190704_0903.py | 21 -- app/jrnl/migrations/0044_auto_20190917_1703.py | 18 -- app/jrnl/migrations/0045_entry_books_new.py | 19 -- app/jrnl/migrations/0046_remove_entry_books.py | 17 -- app/jrnl/migrations/0047_auto_20191110_0859.py | 18 -- app/jrnl/migrations/0048_auto_20191205_1720.py | 18 -- app/jrnl/migrations/0049_entry_newrelated.py | 19 -- app/jrnl/migrations/0050_auto_20191206_0741.py | 18 -- app/jrnl/migrations/0051_auto_20201027_2102.py | 18 -- app/jrnl/migrations/0052_entry_new_field_notes.py | 19 -- app/jrnl/migrations/0053_auto_20201027_2105.py | 18 -- app/jrnl/migrations/0054_auto_20201111_2148.py | 23 -- app/jrnl/migrations/__init__.py | 0 app/jrnl/models.py | 309 --------------------- app/jrnl/templates/horizontal_select.html | 17 -- app/jrnl/templates/jrnl/entry_detail.html | 240 ---------------- app/jrnl/templates/jrnl/entry_detail.txt | 8 - app/jrnl/templates/jrnl/entry_list.html | 33 --- app/jrnl/urls.py | 61 ---- app/jrnl/views.py | 165 ----------- app/locations/build.py | 12 + app/locations/views.py | 14 +- app/pages/admin.py | 16 +- app/pages/migrations/0007_homepage.py | 28 ++ app/pages/migrations/0008_auto_20201114_0934.py | 30 ++ app/pages/models.py | 15 + app/pages/templates/pages/homepage.html | 98 +++++++ app/pages/views.py | 24 +- app/posts/build.py | 78 +++++- app/posts/migrations/0001_initial.py | 2 - app/posts/templates/posts/jrnl_detail.txt | 2 +- app/posts/templates/posts/jrnl_latest.html | 6 + app/posts/views/jrnl_views.py | 2 +- app/publications/__init__.py | 0 app/publications/admin.py | 85 ------ app/publications/migrations/0001_initial.py | 73 ----- app/publications/migrations/0002_editor_section.py | 18 -- .../migrations/0003_auto_20190131_0923.py | 37 --- app/publications/migrations/0004_pitchidea.py | 28 -- .../migrations/0005_auto_20190131_1100.py | 23 -- .../migrations/0006_auto_20190222_1819.py | 33 --- app/publications/migrations/__init__.py | 0 app/publications/models.py | 133 --------- app/publications/urls.py | 24 -- app/publications/views.py | 20 -- app/taxonomy/migrations/0004_auto_20201114_0757.py | 35 +++ app/unused_apps/fieldnotes_/__init__.py | 0 app/unused_apps/fieldnotes_/admin.py | 38 +++ app/unused_apps/fieldnotes_/build.py | 36 +++ .../fieldnotes_/migrations/0001_initial.py | 37 +++ .../migrations/0002_auto_20190303_1222.py | 25 ++ app/unused_apps/fieldnotes_/migrations/__init__.py | 0 app/unused_apps/fieldnotes_/models.py | 113 ++++++++ .../fieldnotes/fieldnote_archive_list_date.html | 43 +++ .../templates/fieldnotes/fieldnote_detail.html | 95 +++++++ .../templates/fieldnotes/fieldnote_list.html | 49 ++++ app/unused_apps/fieldnotes_/urls.py | 39 +++ app/unused_apps/fieldnotes_/views.py | 37 +++ app/unused_apps/jrnl/__init__.py | 0 app/unused_apps/jrnl/admin.py | 129 +++++++++ app/unused_apps/jrnl/build.py | 100 +++++++ app/unused_apps/jrnl/export.py | 20 ++ app/unused_apps/jrnl/fields.py | 7 + app/unused_apps/jrnl/migrations/0001_initial.py | 75 +++++ .../0001_squashed_0019_remove_entry_thumbnail.py | 81 ++++++ .../jrnl/migrations/0002_entrytitlesong.py | 32 +++ .../jrnl/migrations/0003_auto_20160309_1018.py | 31 +++ .../jrnl/migrations/0004_auto_20160309_1031.py | 30 ++ .../jrnl/migrations/0005_auto_20160514_2151.py | 20 ++ .../jrnl/migrations/0006_auto_20160715_0703.py | 37 +++ .../jrnl/migrations/0007_delete_postimage.py | 18 ++ .../jrnl/migrations/0008_auto_20160906_0845.py | 33 +++ .../0009_homepagecurrator_image_offset_vertical.py | 21 ++ .../jrnl/migrations/0010_auto_20161102_0916.py | 22 ++ .../jrnl/migrations/0011_auto_20161102_0925.py | 22 ++ .../jrnl/migrations/0012_auto_20161102_0930.py | 30 ++ .../jrnl/migrations/0013_entry_featured_image.py | 22 ++ .../jrnl/migrations/0014_homepagecurrator.py | 29 ++ .../jrnl/migrations/0015_entry_has_video.py | 21 ++ .../jrnl/migrations/0016_auto_20161219_1058.py | 21 ++ .../jrnl/migrations/0017_entry_field_notes.py | 13 + .../jrnl/migrations/0018_auto_20180303_1037.py | 24 ++ .../jrnl/migrations/0019_remove_entry_thumbnail.py | 13 + .../jrnl/migrations/0020_auto_20180606_1058.py | 19 ++ .../jrnl/migrations/0021_auto_20180606_1058.py | 19 ++ .../jrnl/migrations/0022_auto_20180707_0958.py | 19 ++ .../jrnl/migrations/0023_auto_20180902_1210.py | 18 ++ .../jrnl/migrations/0024_auto_20180902_1217.py | 32 +++ .../jrnl/migrations/0025_auto_20190131_2335.py | 28 ++ .../jrnl/migrations/0026_entry_country_name.py | 18 ++ .../jrnl/migrations/0027_entry_country_slug.py | 18 ++ .../jrnl/migrations/0028_auto_20190218_1614.py | 33 +++ .../jrnl/migrations/0029_home_more_popular.py | 18 ++ .../jrnl/migrations/0030_remove_home_popular.py | 17 ++ .../jrnl/migrations/0031_auto_20190220_1136.py | 22 ++ .../jrnl/migrations/0032_entry_subtitle.py | 18 ++ .../jrnl/migrations/0033_entry_field_notes_two.py | 19 ++ .../migrations/0034_remove_entry_field_notes.py | 17 ++ .../jrnl/migrations/0035_auto_20190303_1610.py | 18 ++ app/unused_apps/jrnl/migrations/0036_enjoyitem.py | 23 ++ .../jrnl/migrations/0037_enjoyitem_entry.py | 20 ++ .../jrnl/migrations/0038_remove_enjoyitem_entry.py | 17 ++ .../jrnl/migrations/0039_enjoyitem_order.py | 18 ++ .../jrnl/migrations/0040_auto_20190315_1906.py | 20 ++ .../jrnl/migrations/0041_auto_20190315_2240.py | 28 ++ .../jrnl/migrations/0042_auto_20190412_1805.py | 24 ++ .../jrnl/migrations/0043_auto_20190704_0903.py | 21 ++ .../jrnl/migrations/0044_auto_20190917_1703.py | 18 ++ .../jrnl/migrations/0045_entry_books_new.py | 19 ++ .../jrnl/migrations/0046_remove_entry_books.py | 17 ++ .../jrnl/migrations/0047_auto_20191110_0859.py | 18 ++ .../jrnl/migrations/0048_auto_20191205_1720.py | 18 ++ .../jrnl/migrations/0049_entry_newrelated.py | 19 ++ .../jrnl/migrations/0050_auto_20191206_0741.py | 18 ++ .../jrnl/migrations/0051_auto_20201027_2102.py | 18 ++ .../jrnl/migrations/0052_entry_new_field_notes.py | 19 ++ .../jrnl/migrations/0053_auto_20201027_2105.py | 18 ++ .../jrnl/migrations/0054_auto_20201111_2148.py | 23 ++ app/unused_apps/jrnl/migrations/__init__.py | 0 app/unused_apps/jrnl/models.py | 309 +++++++++++++++++++++ .../jrnl/templates/horizontal_select.html | 17 ++ .../jrnl/templates/jrnl/entry_detail.html | 240 ++++++++++++++++ .../jrnl/templates/jrnl/entry_detail.txt | 8 + .../jrnl/templates/jrnl/entry_list.html | 33 +++ app/unused_apps/jrnl/urls.py | 61 ++++ app/unused_apps/jrnl/views.py | 165 +++++++++++ app/unused_apps/publications/__init__.py | 0 app/unused_apps/publications/admin.py | 85 ++++++ .../publications/migrations/0001_initial.py | 73 +++++ .../publications/migrations/0002_editor_section.py | 18 ++ .../migrations/0003_auto_20190131_0923.py | 37 +++ .../publications/migrations/0004_pitchidea.py | 28 ++ .../migrations/0005_auto_20190131_1100.py | 23 ++ .../migrations/0006_auto_20190222_1819.py | 33 +++ .../publications/migrations/__init__.py | 0 app/unused_apps/publications/models.py | 133 +++++++++ app/unused_apps/publications/urls.py | 24 ++ app/unused_apps/publications/views.py | 20 ++ 199 files changed, 3752 insertions(+), 3450 deletions(-) delete mode 100644 app/fieldnotes/__init__.py delete mode 100644 app/fieldnotes/admin.py delete mode 100644 app/fieldnotes/build.py delete mode 100644 app/fieldnotes/migrations/0001_initial.py delete mode 100644 app/fieldnotes/migrations/0002_auto_20190303_1222.py delete mode 100644 app/fieldnotes/migrations/__init__.py delete mode 100644 app/fieldnotes/models.py delete mode 100644 app/fieldnotes/templates/fieldnotes/fieldnote_archive_list_date.html delete mode 100644 app/fieldnotes/templates/fieldnotes/fieldnote_detail.html delete mode 100644 app/fieldnotes/templates/fieldnotes/fieldnote_list.html delete mode 100644 app/fieldnotes/urls.py delete mode 100644 app/fieldnotes/views.py delete mode 100644 app/jrnl/__init__.py delete mode 100644 app/jrnl/admin.py delete mode 100644 app/jrnl/build.py delete mode 100644 app/jrnl/export.py delete mode 100644 app/jrnl/fields.py delete mode 100644 app/jrnl/migrations/0001_initial.py delete mode 100644 app/jrnl/migrations/0001_squashed_0019_remove_entry_thumbnail.py delete mode 100644 app/jrnl/migrations/0002_entrytitlesong.py delete mode 100644 app/jrnl/migrations/0003_auto_20160309_1018.py delete mode 100644 app/jrnl/migrations/0004_auto_20160309_1031.py delete mode 100644 app/jrnl/migrations/0005_auto_20160514_2151.py delete mode 100644 app/jrnl/migrations/0006_auto_20160715_0703.py delete mode 100644 app/jrnl/migrations/0007_delete_postimage.py delete mode 100644 app/jrnl/migrations/0008_auto_20160906_0845.py delete mode 100644 app/jrnl/migrations/0009_homepagecurrator_image_offset_vertical.py delete mode 100644 app/jrnl/migrations/0010_auto_20161102_0916.py delete mode 100644 app/jrnl/migrations/0011_auto_20161102_0925.py delete mode 100644 app/jrnl/migrations/0012_auto_20161102_0930.py delete mode 100644 app/jrnl/migrations/0013_entry_featured_image.py delete mode 100644 app/jrnl/migrations/0014_homepagecurrator.py delete mode 100644 app/jrnl/migrations/0015_entry_has_video.py delete mode 100644 app/jrnl/migrations/0016_auto_20161219_1058.py delete mode 100644 app/jrnl/migrations/0017_entry_field_notes.py delete mode 100644 app/jrnl/migrations/0018_auto_20180303_1037.py delete mode 100644 app/jrnl/migrations/0019_remove_entry_thumbnail.py delete mode 100644 app/jrnl/migrations/0020_auto_20180606_1058.py delete mode 100644 app/jrnl/migrations/0021_auto_20180606_1058.py delete mode 100644 app/jrnl/migrations/0022_auto_20180707_0958.py delete mode 100644 app/jrnl/migrations/0023_auto_20180902_1210.py delete mode 100644 app/jrnl/migrations/0024_auto_20180902_1217.py delete mode 100644 app/jrnl/migrations/0025_auto_20190131_2335.py delete mode 100644 app/jrnl/migrations/0026_entry_country_name.py delete mode 100644 app/jrnl/migrations/0027_entry_country_slug.py delete mode 100644 app/jrnl/migrations/0028_auto_20190218_1614.py delete mode 100644 app/jrnl/migrations/0029_home_more_popular.py delete mode 100644 app/jrnl/migrations/0030_remove_home_popular.py delete mode 100644 app/jrnl/migrations/0031_auto_20190220_1136.py delete mode 100644 app/jrnl/migrations/0032_entry_subtitle.py delete mode 100644 app/jrnl/migrations/0033_entry_field_notes_two.py delete mode 100644 app/jrnl/migrations/0034_remove_entry_field_notes.py delete mode 100644 app/jrnl/migrations/0035_auto_20190303_1610.py delete mode 100644 app/jrnl/migrations/0036_enjoyitem.py delete mode 100644 app/jrnl/migrations/0037_enjoyitem_entry.py delete mode 100644 app/jrnl/migrations/0038_remove_enjoyitem_entry.py delete mode 100644 app/jrnl/migrations/0039_enjoyitem_order.py delete mode 100644 app/jrnl/migrations/0040_auto_20190315_1906.py delete mode 100644 app/jrnl/migrations/0041_auto_20190315_2240.py delete mode 100644 app/jrnl/migrations/0042_auto_20190412_1805.py delete mode 100644 app/jrnl/migrations/0043_auto_20190704_0903.py delete mode 100644 app/jrnl/migrations/0044_auto_20190917_1703.py delete mode 100644 app/jrnl/migrations/0045_entry_books_new.py delete mode 100644 app/jrnl/migrations/0046_remove_entry_books.py delete mode 100644 app/jrnl/migrations/0047_auto_20191110_0859.py delete mode 100644 app/jrnl/migrations/0048_auto_20191205_1720.py delete mode 100644 app/jrnl/migrations/0049_entry_newrelated.py delete mode 100644 app/jrnl/migrations/0050_auto_20191206_0741.py delete mode 100644 app/jrnl/migrations/0051_auto_20201027_2102.py delete mode 100644 app/jrnl/migrations/0052_entry_new_field_notes.py delete mode 100644 app/jrnl/migrations/0053_auto_20201027_2105.py delete mode 100644 app/jrnl/migrations/0054_auto_20201111_2148.py delete mode 100644 app/jrnl/migrations/__init__.py delete mode 100644 app/jrnl/models.py delete mode 100644 app/jrnl/templates/horizontal_select.html delete mode 100644 app/jrnl/templates/jrnl/entry_detail.html delete mode 100644 app/jrnl/templates/jrnl/entry_detail.txt delete mode 100644 app/jrnl/templates/jrnl/entry_list.html delete mode 100644 app/jrnl/urls.py delete mode 100644 app/jrnl/views.py create mode 100644 app/locations/build.py create mode 100644 app/pages/migrations/0007_homepage.py create mode 100644 app/pages/migrations/0008_auto_20201114_0934.py create mode 100644 app/pages/templates/pages/homepage.html create mode 100644 app/posts/templates/posts/jrnl_latest.html delete mode 100644 app/publications/__init__.py delete mode 100644 app/publications/admin.py delete mode 100644 app/publications/migrations/0001_initial.py delete mode 100644 app/publications/migrations/0002_editor_section.py delete mode 100644 app/publications/migrations/0003_auto_20190131_0923.py delete mode 100644 app/publications/migrations/0004_pitchidea.py delete mode 100644 app/publications/migrations/0005_auto_20190131_1100.py delete mode 100644 app/publications/migrations/0006_auto_20190222_1819.py delete mode 100644 app/publications/migrations/__init__.py delete mode 100644 app/publications/models.py delete mode 100644 app/publications/urls.py delete mode 100644 app/publications/views.py create mode 100644 app/taxonomy/migrations/0004_auto_20201114_0757.py create mode 100644 app/unused_apps/fieldnotes_/__init__.py create mode 100644 app/unused_apps/fieldnotes_/admin.py create mode 100644 app/unused_apps/fieldnotes_/build.py create mode 100644 app/unused_apps/fieldnotes_/migrations/0001_initial.py create mode 100644 app/unused_apps/fieldnotes_/migrations/0002_auto_20190303_1222.py create mode 100644 app/unused_apps/fieldnotes_/migrations/__init__.py create mode 100644 app/unused_apps/fieldnotes_/models.py create mode 100644 app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_archive_list_date.html create mode 100644 app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_detail.html create mode 100644 app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_list.html create mode 100644 app/unused_apps/fieldnotes_/urls.py create mode 100644 app/unused_apps/fieldnotes_/views.py create mode 100644 app/unused_apps/jrnl/__init__.py create mode 100644 app/unused_apps/jrnl/admin.py create mode 100644 app/unused_apps/jrnl/build.py create mode 100644 app/unused_apps/jrnl/export.py create mode 100644 app/unused_apps/jrnl/fields.py create mode 100644 app/unused_apps/jrnl/migrations/0001_initial.py create mode 100644 app/unused_apps/jrnl/migrations/0001_squashed_0019_remove_entry_thumbnail.py create mode 100644 app/unused_apps/jrnl/migrations/0002_entrytitlesong.py create mode 100644 app/unused_apps/jrnl/migrations/0003_auto_20160309_1018.py create mode 100644 app/unused_apps/jrnl/migrations/0004_auto_20160309_1031.py create mode 100644 app/unused_apps/jrnl/migrations/0005_auto_20160514_2151.py create mode 100644 app/unused_apps/jrnl/migrations/0006_auto_20160715_0703.py create mode 100644 app/unused_apps/jrnl/migrations/0007_delete_postimage.py create mode 100644 app/unused_apps/jrnl/migrations/0008_auto_20160906_0845.py create mode 100644 app/unused_apps/jrnl/migrations/0009_homepagecurrator_image_offset_vertical.py create mode 100644 app/unused_apps/jrnl/migrations/0010_auto_20161102_0916.py create mode 100644 app/unused_apps/jrnl/migrations/0011_auto_20161102_0925.py create mode 100644 app/unused_apps/jrnl/migrations/0012_auto_20161102_0930.py create mode 100644 app/unused_apps/jrnl/migrations/0013_entry_featured_image.py create mode 100644 app/unused_apps/jrnl/migrations/0014_homepagecurrator.py create mode 100644 app/unused_apps/jrnl/migrations/0015_entry_has_video.py create mode 100644 app/unused_apps/jrnl/migrations/0016_auto_20161219_1058.py create mode 100644 app/unused_apps/jrnl/migrations/0017_entry_field_notes.py create mode 100644 app/unused_apps/jrnl/migrations/0018_auto_20180303_1037.py create mode 100644 app/unused_apps/jrnl/migrations/0019_remove_entry_thumbnail.py create mode 100644 app/unused_apps/jrnl/migrations/0020_auto_20180606_1058.py create mode 100644 app/unused_apps/jrnl/migrations/0021_auto_20180606_1058.py create mode 100644 app/unused_apps/jrnl/migrations/0022_auto_20180707_0958.py create mode 100644 app/unused_apps/jrnl/migrations/0023_auto_20180902_1210.py create mode 100644 app/unused_apps/jrnl/migrations/0024_auto_20180902_1217.py create mode 100644 app/unused_apps/jrnl/migrations/0025_auto_20190131_2335.py create mode 100644 app/unused_apps/jrnl/migrations/0026_entry_country_name.py create mode 100644 app/unused_apps/jrnl/migrations/0027_entry_country_slug.py create mode 100644 app/unused_apps/jrnl/migrations/0028_auto_20190218_1614.py create mode 100644 app/unused_apps/jrnl/migrations/0029_home_more_popular.py create mode 100644 app/unused_apps/jrnl/migrations/0030_remove_home_popular.py create mode 100644 app/unused_apps/jrnl/migrations/0031_auto_20190220_1136.py create mode 100644 app/unused_apps/jrnl/migrations/0032_entry_subtitle.py create mode 100644 app/unused_apps/jrnl/migrations/0033_entry_field_notes_two.py create mode 100644 app/unused_apps/jrnl/migrations/0034_remove_entry_field_notes.py create mode 100644 app/unused_apps/jrnl/migrations/0035_auto_20190303_1610.py create mode 100644 app/unused_apps/jrnl/migrations/0036_enjoyitem.py create mode 100644 app/unused_apps/jrnl/migrations/0037_enjoyitem_entry.py create mode 100644 app/unused_apps/jrnl/migrations/0038_remove_enjoyitem_entry.py create mode 100644 app/unused_apps/jrnl/migrations/0039_enjoyitem_order.py create mode 100644 app/unused_apps/jrnl/migrations/0040_auto_20190315_1906.py create mode 100644 app/unused_apps/jrnl/migrations/0041_auto_20190315_2240.py create mode 100644 app/unused_apps/jrnl/migrations/0042_auto_20190412_1805.py create mode 100644 app/unused_apps/jrnl/migrations/0043_auto_20190704_0903.py create mode 100644 app/unused_apps/jrnl/migrations/0044_auto_20190917_1703.py create mode 100644 app/unused_apps/jrnl/migrations/0045_entry_books_new.py create mode 100644 app/unused_apps/jrnl/migrations/0046_remove_entry_books.py create mode 100644 app/unused_apps/jrnl/migrations/0047_auto_20191110_0859.py create mode 100644 app/unused_apps/jrnl/migrations/0048_auto_20191205_1720.py create mode 100644 app/unused_apps/jrnl/migrations/0049_entry_newrelated.py create mode 100644 app/unused_apps/jrnl/migrations/0050_auto_20191206_0741.py create mode 100644 app/unused_apps/jrnl/migrations/0051_auto_20201027_2102.py create mode 100644 app/unused_apps/jrnl/migrations/0052_entry_new_field_notes.py create mode 100644 app/unused_apps/jrnl/migrations/0053_auto_20201027_2105.py create mode 100644 app/unused_apps/jrnl/migrations/0054_auto_20201111_2148.py create mode 100644 app/unused_apps/jrnl/migrations/__init__.py create mode 100644 app/unused_apps/jrnl/models.py create mode 100644 app/unused_apps/jrnl/templates/horizontal_select.html create mode 100644 app/unused_apps/jrnl/templates/jrnl/entry_detail.html create mode 100644 app/unused_apps/jrnl/templates/jrnl/entry_detail.txt create mode 100644 app/unused_apps/jrnl/templates/jrnl/entry_list.html create mode 100644 app/unused_apps/jrnl/urls.py create mode 100644 app/unused_apps/jrnl/views.py create mode 100644 app/unused_apps/publications/__init__.py create mode 100644 app/unused_apps/publications/admin.py create mode 100644 app/unused_apps/publications/migrations/0001_initial.py create mode 100644 app/unused_apps/publications/migrations/0002_editor_section.py create mode 100644 app/unused_apps/publications/migrations/0003_auto_20190131_0923.py create mode 100644 app/unused_apps/publications/migrations/0004_pitchidea.py create mode 100644 app/unused_apps/publications/migrations/0005_auto_20190131_1100.py create mode 100644 app/unused_apps/publications/migrations/0006_auto_20190222_1819.py create mode 100644 app/unused_apps/publications/migrations/__init__.py create mode 100644 app/unused_apps/publications/models.py create mode 100644 app/unused_apps/publications/urls.py create mode 100644 app/unused_apps/publications/views.py (limited to 'app') diff --git a/app/builder/views.py b/app/builder/views.py index 7d463a7..5e67dc2 100644 --- a/app/builder/views.py +++ b/app/builder/views.py @@ -1,82 +1,76 @@ from django.shortcuts import render from django.template import RequestContext -from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap -from jrnl.build import archive_builder, detail_builder, home_builder, rss_builder, map_builder +#from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap +#from jrnl.build import archive_builder, detail_builder, home_builder, rss_builder, map_builder from resume.build import pub_builder, resume_builder from books.build import builder as book_builder from sightings.build import builder as sightings_builder from photos.build import builder as photo_builder #from notes.build import builder as notes_builder from pages.build import builder as page_builder -#from fieldnotes.build import builder as fieldnotes_builder from photos.build import dailybuilder -from posts.build import src_builder, guide_builder, fieldnotes_builder +from posts.build import BuildJrnl, BuildFieldNotes, BuildSrc, BuildGuide, BuildHome from lttr.build import lttr_builder -options = { - 'writing': BuildWriting, - 'photo_galleries': BuildPhotos, - 'projects': BuildProjects, - 'feed': BuildWritingFeed, - 'sitemap': BuildSitemap, -} - - def do_build(request): section = request.GET.get('id', '') context = {} if section == 'builddetails': context = {'message': 'Writing Jrnl Permalinks to Disk'} - detail_builder() + p = BuildJrnl("posts", "post") + p.build_latest() + p.build_detail_view() elif section == 'writingarchives': context = {'message': 'Writing Jrnl Archives to Disk'} - archive_builder() - elif section == 'resume': - context = {'message': 'Writing Resume to Disk'} - resume_builder() - elif section == 'pubs': - context = {'message': 'Writing Publications to Disk'} - pub_builder() + BuildJrnl("posts", "post").build_arc() elif section == 'buildrss': context = {'message': 'Writing RSS to Disk'} - rss_builder() - elif section == 'dailyphotos': - context = {'message': 'Writing daily photo pages to Disk'} - dailybuilder() + BuildJrnl("posts", "post").build_feed("jrnl:feed") elif section == 'homepage': context = {'message': 'Writing index to Disk'} - home_builder() + BuildHome("posts", "post").homepage() + elif section == 'src': + context = {'message': 'Writing src section to Disk'} + BuildSrc("posts", "post").build() + elif section == 'guide': + context = {'message': 'Writing guide section to Disk'} + BuildGuide("posts", "post").build() + elif section == 'pages': + context = {'message': 'Writing Pages to Disk'} + page_builder() + elif section == 'fieldnotes': + context = {'message': 'Writing FieldNotes to Disk'} + BuildFieldNotes("posts", "post").build() + elif section == 'lttr_archive': + context = {'message': 'Writing newsletter archives to Disk'} + lttr_builder() elif section == 'buildbooks': context = {'message': 'Writing Book Pages to Disk'} book_builder() elif section == 'buildsightings': context = {'message': 'Writing Sightings Pages to Disk'} sightings_builder() - elif section == 'src': - context = {'message': 'Writing src section to Disk'} - src_builder() - elif section == 'guide': - context = {'message': 'Writing guide section to Disk'} - guide_builder() elif section == 'luxphotos': context = {'message': 'Writing galleries to Disk'} photo_builder() elif section == 'figments': context = {'message': 'Writing figments to Disk'} figments_builder() - elif section == 'pages': - context = {'message': 'Writing Pages to Disk'} - page_builder() + elif section == 'resume': + context = {'message': 'Writing Resume to Disk'} + resume_builder() + elif section == 'pubs': + context = {'message': 'Writing Publications to Disk'} + pub_builder() elif section == 'map': context = {'message': 'Writing Map to Disk'} map_builder() - elif section == 'fieldnotes': - context = {'message': 'Writing FieldNotes to Disk'} - fieldnotes_builder() - elif section == 'lttr_archive': - context = {'message': 'Writing newsletter archives to Disk'} - lttr_builder() - else: - options[section]().build() - context = {'message': 'Writing %s to Disk' % section} + elif section == 'dailyphotos': + context = {'message': 'Writing daily photo pages to Disk'} + dailybuilder() return render(request, 'admin/message.html', context) + + + + + diff --git a/app/fieldnotes/__init__.py b/app/fieldnotes/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/fieldnotes/admin.py b/app/fieldnotes/admin.py deleted file mode 100644 index 838063d..0000000 --- a/app/fieldnotes/admin.py +++ /dev/null @@ -1,38 +0,0 @@ -from django.contrib import admin -from django.contrib.contenttypes.admin import GenericTabularInline - -from .models import FieldNote -from utils.widgets import LGEntryForm, OLAdminBase -from utils.util import get_latlon - - -@admin.register(FieldNote) -class NoteAdmin(OLAdminBase): - form = LGEntryForm - prepopulated_fields = {"slug": ('title',)} - list_display = ('title', 'slug', 'pub_date', 'location') - fieldsets = ( - ('Note', { - 'fields': ( - ('title', 'note_type'), - 'subtitle', - 'body_markdown', - 'slug', - ('pub_date', 'status'), - 'point' - ), - 'classes': ( - 'show', - 'extrapretty', - 'wide' - ) - } - ), - ) - lat, lon = get_latlon() - default_lon = lon - default_lat = lat - default_zoom = 10 - - class Media: - js = ('image-loader.js', 'next-prev-links.js') diff --git a/app/fieldnotes/build.py b/app/fieldnotes/build.py deleted file mode 100644 index 4c5c83b..0000000 --- a/app/fieldnotes/build.py +++ /dev/null @@ -1,36 +0,0 @@ -import os -from django.urls import reverse -from builder.base import BuildNew - - -class BuildNotes(BuildNew): - - def build(self): - self.build_detail_view() - self.build_list_view( - base_path=reverse("fieldnotes:list"), - paginate_by=24 - ) - self.build_year_view("fieldnotes:list_year") - self.build_month_view("fieldnotes:list_month") - - def get_model_queryset(self): - return self.model.objects.all() - - def build_detail_view(self): - ''' - write out all the expenses for each trip - ''' - for obj in self.get_model_queryset(): - url = obj.get_absolute_url() - path, slug = os.path.split(url) - path = '%s/' % path - # write html - response = self.client.get(url) - print(path, slug) - self.write_file(path, response.content, filename=slug) - - -def builder(): - j = BuildNotes("fieldnotes", "fieldnote") - j.build() diff --git a/app/fieldnotes/migrations/0001_initial.py b/app/fieldnotes/migrations/0001_initial.py deleted file mode 100644 index cec67fb..0000000 --- a/app/fieldnotes/migrations/0001_initial.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 2.1.7 on 2019-03-03 12:13 - -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): - - initial = True - - dependencies = [ - ('locations', '0017_auto_20190217_1849'), - ] - - operations = [ - migrations.CreateModel( - name='FieldNote', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(blank=True, max_length=250)), - ('subtitle', models.CharField(blank=True, max_length=250)), - ('slug', models.SlugField(blank=True, unique_for_date='pub_date')), - ('pub_date', models.DateTimeField(default=django.utils.timezone.now)), - ('body_html', models.TextField(blank=True)), - ('body_markdown', models.TextField(verbose_name='Note')), - ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)), - ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=1)), - ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), - ], - options={ - 'get_latest_by': 'pub_date', - 'ordering': ('-pub_date',), - }, - ), - ] diff --git a/app/fieldnotes/migrations/0002_auto_20190303_1222.py b/app/fieldnotes/migrations/0002_auto_20190303_1222.py deleted file mode 100644 index c0e352e..0000000 --- a/app/fieldnotes/migrations/0002_auto_20190303_1222.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 2.1.7 on 2019-03-03 12:22 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('photos', '0018_auto_20161130_1218'), - ('fieldnotes', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='fieldnote', - name='featured_image', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='photos.LuxImage'), - ), - migrations.AddField( - model_name='fieldnote', - name='note_type', - field=models.IntegerField(choices=[(0, 'Note'), (1, 'Photo')], default=0), - ), - ] diff --git a/app/fieldnotes/migrations/__init__.py b/app/fieldnotes/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/fieldnotes/models.py b/app/fieldnotes/models.py deleted file mode 100644 index c14ba80..0000000 --- a/app/fieldnotes/models.py +++ /dev/null @@ -1,113 +0,0 @@ -import re -from django import forms -from django.contrib.gis.db import models -from django.utils import timezone -from django.urls import reverse -from django.conf import settings -from django.contrib.sitemaps import Sitemap - -from locations.models import Location, CheckIn -from photos.models import LuxImage -from utils.util import render_images, parse_image, markdown_to_html, extract_main_image - - -def render_images(s): - s = re.sub('', parse_image, s) - return s - - -class FieldNote(models.Model): - title = models.CharField(max_length=250, blank=True) - subtitle = models.CharField(max_length=250, blank=True) - slug = models.SlugField(unique_for_date='pub_date', blank=True) - pub_date = models.DateTimeField(default=timezone.now) - body_html = models.TextField(blank=True) - body_markdown = models.TextField('Note') - point = models.PointField(blank=True, null=True) - location = models.ForeignKey(Location, on_delete=models.CASCADE, blank=True, null=True) - PUB_STATUS = ( - (0, 'Draft'), - (1, 'Published'), - ) - status = models.IntegerField(choices=PUB_STATUS, default=1) - NOTE_TYPE = ( - (0, 'Note'), - (1, 'Photo'), - ) - note_type = models.IntegerField(choices=NOTE_TYPE, default=0) - featured_image = models.ForeignKey(LuxImage, on_delete=models.SET_NULL, blank=True, null=True) - - class Meta: - ordering = ('-pub_date',) - get_latest_by = 'pub_date' - - def __str__(self): - return self.title - - def get_absolute_url(self): - return reverse("fieldnotes:detail", kwargs={"year": self.pub_date.year, "month": self.pub_date.strftime("%m"), "slug": self.slug}) - - def get_object_type(self): - return 'fieldnote' - - @property - def region(self): - return self.location.lux_region - - @property - def longitude(self): - '''Get the site's longitude.''' - return round(self.point.x, 2) - - @property - def latitude(self): - '''Get the site's latitude.''' - return round(self.point.y, 2) - - @property - def get_previous_published(self): - return self.get_previous_by_pub_date() - - @property - def get_next_published(self): - return self.get_next_by_pub_date() - - @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_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 save(self, *args, **kwargs): - md = render_images(self.body_markdown) - self.body_html = markdown_to_html(md) - if not self.point: - self.point = CheckIn.objects.latest().point - 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 not self.id: - self.pub_date = timezone.now() - self.date_last_updated = timezone.now() - self.featured_image = extract_main_image(self.body_markdown) - super(FieldNote, self).save() - - -class FieldNoteSitemap(Sitemap): - changefreq = "never" - priority = 0.7 - protocol = "https" - - def items(self): - return FieldNote.objects.filter(status=1) - - def lastmod(self, obj): - return obj.pub_date diff --git a/app/fieldnotes/templates/fieldnotes/fieldnote_archive_list_date.html b/app/fieldnotes/templates/fieldnotes/fieldnote_archive_list_date.html deleted file mode 100644 index 5d6865f..0000000 --- a/app/fieldnotes/templates/fieldnotes/fieldnote_archive_list_date.html +++ /dev/null @@ -1,43 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% load html5_datetime %} -{% block pagetitle %} Field Notes | luxagraf {% endblock %} -{% block metadescription %} Rough notes and sketches from the field {% endblock %} -{%block bodyid%}id="field-notes"{%endblock%} - -{% block primary %} - -
-
-

Field Notes {% if month or year %}{% if month %} from {{month|date:"F"}} {{month|date:"Y"}}{%else%} from {{year|date:"Y"}}{%endif%}{%endif%}

-

Quick notes, sketches and images from the road. This is the semi-orgnized brain dump that comes before the more organized journal entries and essays. If I used social media this is the stuff I'd probably put there, but I prefer to put it here, even if it means a lot few people read it.

-
- -
- -{% endblock %} - - - diff --git a/app/fieldnotes/templates/fieldnotes/fieldnote_detail.html b/app/fieldnotes/templates/fieldnotes/fieldnote_detail.html deleted file mode 100644 index d1c648b..0000000 --- a/app/fieldnotes/templates/fieldnotes/fieldnote_detail.html +++ /dev/null @@ -1,95 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% load html5_datetime %} -{% load month_number_to_name %} -{% block pagetitle %}{{object.title|title|smartypants|safe}} - Luxagraf, Field Notes{% endblock %} - -{% block metadescription %}{{object.body_html|striptags|safe|truncatewords:30}}{% endblock %} -{%block extrahead%} - - - - - -{%endblock%} -{% block bodyid %}class="notes--permalin detail" id="archive-{% if month %}{{month|month_number_to_name}}{%endif%}{{year}}"{%endblock%} -{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} -{% block primary %}
-
-
-

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

- {% if object.subtitle %}

{{object.subtitle|smartypants|safe}}

{%endif%} -
- {% if object.location %}
-

{% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state_name|safe}}, U.S.{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name|safe}}{%endif%}

- – Map -
{%endif%} - - -
-
-
- {{object.body_html|safe|smartypants}} -
- - - - - - - - {% with object.get_next_published as next %} - {% with object.get_previous_published as prev %} - {%endwith%}{%endwith%} -
-
-{% endblock %} - -{% block js %} - -{%endblock%} diff --git a/app/fieldnotes/templates/fieldnotes/fieldnote_list.html b/app/fieldnotes/templates/fieldnotes/fieldnote_list.html deleted file mode 100644 index 37cd0ca..0000000 --- a/app/fieldnotes/templates/fieldnotes/fieldnote_list.html +++ /dev/null @@ -1,49 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% load get_next %} -{% load html5_datetime %} -{% load pagination_tags %} -{% block pagetitle %} Field Notes | luxagraf {% endblock %} -{% block metadescription %}Rough notes and sketches from the field {% endblock %} -{%block bodyid%}id="field-notes"{%endblock%} -{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} -{% block primary %}
-
-

Field Notes

-

Quick notes, sketches, and images from the road. This is the semi-organized brain dump that comes before the more organized journal entries. If I used social media this is the stuff I'd probably put there, but I prefer to put it here, even if it means a lot fewer people read it.

-
- {% autopaginate object_list 30 %} - -
- -{% endblock %} - - - diff --git a/app/fieldnotes/urls.py b/app/fieldnotes/urls.py deleted file mode 100644 index 85ee710..0000000 --- a/app/fieldnotes/urls.py +++ /dev/null @@ -1,39 +0,0 @@ -from django.urls import path, re_path - -from . import views - -app_name = "field notes" - -urlpatterns = [ - re_path( - r'(?P[0-9]{4})/$', - views.FieldNoteYearArchiveView.as_view(), - name="list_year" - ), - path( - r'', - views.FieldNoteListView.as_view(), - {'page': 1}, - name="list" - ), - path( - r'/', - views.FieldNoteListView.as_view(), - name="list" - ), - path( - r'//.txt', - views.FieldNoteDetailViewTXT.as_view(), - name="detail-txt" - ), - path( - r'//', - views.FieldNoteDetailView.as_view(), - name="detail" - ), - path( - r'//', - views.FieldNoteMonthArchiveView.as_view(month_format='%m'), - name="list_month" - ), -] diff --git a/app/fieldnotes/views.py b/app/fieldnotes/views.py deleted file mode 100644 index 9b49cc0..0000000 --- a/app/fieldnotes/views.py +++ /dev/null @@ -1,37 +0,0 @@ -from django.views.generic.dates import YearArchiveView, MonthArchiveView -from django.views.generic.detail import DetailView - -from utils.views import PaginatedListView, LuxDetailView - -from .models import FieldNote - - -class FieldNoteListView(PaginatedListView): - model = FieldNote - """ - Return a list of Notes in reverse chronological order - """ - queryset = FieldNote.objects.filter(status=1).order_by('-pub_date') - - -class FieldNoteDetailView(LuxDetailView): - model = FieldNote - slug_field = "slug" - - -class FieldNoteDetailViewTXT(FieldNoteDetailView): - template_name = "jrnl/entry.txt" - - -class FieldNoteYearArchiveView(YearArchiveView): - queryset = FieldNote.objects.filter(status=1) - date_field = "pub_date" - template_name = "fieldnotes/fieldnote_archive_list_date.html" - make_object_list = True - - -class FieldNoteMonthArchiveView(MonthArchiveView): - queryset = FieldNote.objects.filter(status=1) - date_field = "pub_date" - make_object_list = True - template_name = "fieldnotes/fieldnote_archive_list_date.html" diff --git a/app/jrnl/__init__.py b/app/jrnl/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/jrnl/admin.py b/app/jrnl/admin.py deleted file mode 100644 index 32ef69b..0000000 --- a/app/jrnl/admin.py +++ /dev/null @@ -1,129 +0,0 @@ -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/jrnl/build.py b/app/jrnl/build.py deleted file mode 100644 index dcebace..0000000 --- a/app/jrnl/build.py +++ /dev/null @@ -1,100 +0,0 @@ -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/jrnl/export.py b/app/jrnl/export.py deleted file mode 100644 index 6407491..0000000 --- a/app/jrnl/export.py +++ /dev/null @@ -1,20 +0,0 @@ -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(''): - 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/jrnl/fields.py b/app/jrnl/fields.py deleted file mode 100644 index 8df2f5e..0000000 --- a/app/jrnl/fields.py +++ /dev/null @@ -1,7 +0,0 @@ -from django import forms - -from .widgets import AdminImageWidget - - -class FileUploadForm(forms.ModelForm): - upload = forms.FileField(widget=AdminImageWidget) diff --git a/app/jrnl/migrations/0001_initial.py b/app/jrnl/migrations/0001_initial.py deleted file mode 100644 index a3660ab..0000000 --- a/app/jrnl/migrations/0001_initial.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- 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/jrnl/migrations/0001_squashed_0019_remove_entry_thumbnail.py b/app/jrnl/migrations/0001_squashed_0019_remove_entry_thumbnail.py deleted file mode 100644 index 7b1b247..0000000 --- a/app/jrnl/migrations/0001_squashed_0019_remove_entry_thumbnail.py +++ /dev/null @@ -1,81 +0,0 @@ -# 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/jrnl/migrations/0002_entrytitlesong.py b/app/jrnl/migrations/0002_entrytitlesong.py deleted file mode 100644 index 66a75a6..0000000 --- a/app/jrnl/migrations/0002_entrytitlesong.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- 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/jrnl/migrations/0003_auto_20160309_1018.py b/app/jrnl/migrations/0003_auto_20160309_1018.py deleted file mode 100644 index 49a3f6f..0000000 --- a/app/jrnl/migrations/0003_auto_20160309_1018.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- 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/jrnl/migrations/0004_auto_20160309_1031.py b/app/jrnl/migrations/0004_auto_20160309_1031.py deleted file mode 100644 index 33bbe05..0000000 --- a/app/jrnl/migrations/0004_auto_20160309_1031.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- 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/jrnl/migrations/0005_auto_20160514_2151.py b/app/jrnl/migrations/0005_auto_20160514_2151.py deleted file mode 100644 index 701c8c3..0000000 --- a/app/jrnl/migrations/0005_auto_20160514_2151.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- 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/jrnl/migrations/0006_auto_20160715_0703.py b/app/jrnl/migrations/0006_auto_20160715_0703.py deleted file mode 100644 index 42efc43..0000000 --- a/app/jrnl/migrations/0006_auto_20160715_0703.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- 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/jrnl/migrations/0007_delete_postimage.py b/app/jrnl/migrations/0007_delete_postimage.py deleted file mode 100644 index cc481e8..0000000 --- a/app/jrnl/migrations/0007_delete_postimage.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- 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/jrnl/migrations/0008_auto_20160906_0845.py b/app/jrnl/migrations/0008_auto_20160906_0845.py deleted file mode 100644 index 4ac5ebf..0000000 --- a/app/jrnl/migrations/0008_auto_20160906_0845.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- 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/jrnl/migrations/0009_homepagecurrator_image_offset_vertical.py b/app/jrnl/migrations/0009_homepagecurrator_image_offset_vertical.py deleted file mode 100644 index 5dfbbad..0000000 --- a/app/jrnl/migrations/0009_homepagecurrator_image_offset_vertical.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- 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/jrnl/migrations/0010_auto_20161102_0916.py b/app/jrnl/migrations/0010_auto_20161102_0916.py deleted file mode 100644 index a2d9eb8..0000000 --- a/app/jrnl/migrations/0010_auto_20161102_0916.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- 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/jrnl/migrations/0011_auto_20161102_0925.py b/app/jrnl/migrations/0011_auto_20161102_0925.py deleted file mode 100644 index e11c1ba..0000000 --- a/app/jrnl/migrations/0011_auto_20161102_0925.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- 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/jrnl/migrations/0012_auto_20161102_0930.py b/app/jrnl/migrations/0012_auto_20161102_0930.py deleted file mode 100644 index d1a65dd..0000000 --- a/app/jrnl/migrations/0012_auto_20161102_0930.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- 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/jrnl/migrations/0013_entry_featured_image.py b/app/jrnl/migrations/0013_entry_featured_image.py deleted file mode 100644 index c607ca7..0000000 --- a/app/jrnl/migrations/0013_entry_featured_image.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- 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/jrnl/migrations/0014_homepagecurrator.py b/app/jrnl/migrations/0014_homepagecurrator.py deleted file mode 100644 index 2d34866..0000000 --- a/app/jrnl/migrations/0014_homepagecurrator.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- 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/jrnl/migrations/0015_entry_has_video.py b/app/jrnl/migrations/0015_entry_has_video.py deleted file mode 100644 index b643342..0000000 --- a/app/jrnl/migrations/0015_entry_has_video.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- 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/jrnl/migrations/0016_auto_20161219_1058.py b/app/jrnl/migrations/0016_auto_20161219_1058.py deleted file mode 100644 index f9a3fc8..0000000 --- a/app/jrnl/migrations/0016_auto_20161219_1058.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- 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/jrnl/migrations/0017_entry_field_notes.py b/app/jrnl/migrations/0017_entry_field_notes.py deleted file mode 100644 index f131183..0000000 --- a/app/jrnl/migrations/0017_entry_field_notes.py +++ /dev/null @@ -1,13 +0,0 @@ -# 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/jrnl/migrations/0018_auto_20180303_1037.py b/app/jrnl/migrations/0018_auto_20180303_1037.py deleted file mode 100644 index 2b4baa6..0000000 --- a/app/jrnl/migrations/0018_auto_20180303_1037.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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/jrnl/migrations/0019_remove_entry_thumbnail.py b/app/jrnl/migrations/0019_remove_entry_thumbnail.py deleted file mode 100644 index 971cb03..0000000 --- a/app/jrnl/migrations/0019_remove_entry_thumbnail.py +++ /dev/null @@ -1,13 +0,0 @@ -# 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/jrnl/migrations/0020_auto_20180606_1058.py b/app/jrnl/migrations/0020_auto_20180606_1058.py deleted file mode 100644 index 7575d4f..0000000 --- a/app/jrnl/migrations/0020_auto_20180606_1058.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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/jrnl/migrations/0021_auto_20180606_1058.py b/app/jrnl/migrations/0021_auto_20180606_1058.py deleted file mode 100644 index ab42290..0000000 --- a/app/jrnl/migrations/0021_auto_20180606_1058.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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/jrnl/migrations/0022_auto_20180707_0958.py b/app/jrnl/migrations/0022_auto_20180707_0958.py deleted file mode 100644 index 809f562..0000000 --- a/app/jrnl/migrations/0022_auto_20180707_0958.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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/jrnl/migrations/0023_auto_20180902_1210.py b/app/jrnl/migrations/0023_auto_20180902_1210.py deleted file mode 100644 index 0ce3853..0000000 --- a/app/jrnl/migrations/0023_auto_20180902_1210.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0024_auto_20180902_1217.py b/app/jrnl/migrations/0024_auto_20180902_1217.py deleted file mode 100644 index 314c8c6..0000000 --- a/app/jrnl/migrations/0024_auto_20180902_1217.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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/jrnl/migrations/0025_auto_20190131_2335.py b/app/jrnl/migrations/0025_auto_20190131_2335.py deleted file mode 100644 index 60b9a8c..0000000 --- a/app/jrnl/migrations/0025_auto_20190131_2335.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 deleted file mode 100644 index 22d07f9..0000000 --- a/app/jrnl/migrations/0026_entry_country_name.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/migrations/0027_entry_country_slug.py b/app/jrnl/migrations/0027_entry_country_slug.py deleted file mode 100644 index 4560497..0000000 --- a/app/jrnl/migrations/0027_entry_country_slug.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0028_auto_20190218_1614.py b/app/jrnl/migrations/0028_auto_20190218_1614.py deleted file mode 100644 index aff2331..0000000 --- a/app/jrnl/migrations/0028_auto_20190218_1614.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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/jrnl/migrations/0029_home_more_popular.py b/app/jrnl/migrations/0029_home_more_popular.py deleted file mode 100644 index 2adc219..0000000 --- a/app/jrnl/migrations/0029_home_more_popular.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0030_remove_home_popular.py b/app/jrnl/migrations/0030_remove_home_popular.py deleted file mode 100644 index 8ac7408..0000000 --- a/app/jrnl/migrations/0030_remove_home_popular.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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/jrnl/migrations/0031_auto_20190220_1136.py b/app/jrnl/migrations/0031_auto_20190220_1136.py deleted file mode 100644 index 621b692..0000000 --- a/app/jrnl/migrations/0031_auto_20190220_1136.py +++ /dev/null @@ -1,22 +0,0 @@ -# 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/jrnl/migrations/0032_entry_subtitle.py b/app/jrnl/migrations/0032_entry_subtitle.py deleted file mode 100644 index d5ccc80..0000000 --- a/app/jrnl/migrations/0032_entry_subtitle.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0033_entry_field_notes_two.py b/app/jrnl/migrations/0033_entry_field_notes_two.py deleted file mode 100644 index b90e86b..0000000 --- a/app/jrnl/migrations/0033_entry_field_notes_two.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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/jrnl/migrations/0034_remove_entry_field_notes.py b/app/jrnl/migrations/0034_remove_entry_field_notes.py deleted file mode 100644 index a0e93b0..0000000 --- a/app/jrnl/migrations/0034_remove_entry_field_notes.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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/jrnl/migrations/0035_auto_20190303_1610.py b/app/jrnl/migrations/0035_auto_20190303_1610.py deleted file mode 100644 index 7b51186..0000000 --- a/app/jrnl/migrations/0035_auto_20190303_1610.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0036_enjoyitem.py b/app/jrnl/migrations/0036_enjoyitem.py deleted file mode 100644 index aaa8596..0000000 --- a/app/jrnl/migrations/0036_enjoyitem.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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/jrnl/migrations/0037_enjoyitem_entry.py b/app/jrnl/migrations/0037_enjoyitem_entry.py deleted file mode 100644 index 733f94c..0000000 --- a/app/jrnl/migrations/0037_enjoyitem_entry.py +++ /dev/null @@ -1,20 +0,0 @@ -# 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/jrnl/migrations/0038_remove_enjoyitem_entry.py b/app/jrnl/migrations/0038_remove_enjoyitem_entry.py deleted file mode 100644 index 0eec153..0000000 --- a/app/jrnl/migrations/0038_remove_enjoyitem_entry.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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/jrnl/migrations/0039_enjoyitem_order.py b/app/jrnl/migrations/0039_enjoyitem_order.py deleted file mode 100644 index 41c5324..0000000 --- a/app/jrnl/migrations/0039_enjoyitem_order.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0040_auto_20190315_1906.py b/app/jrnl/migrations/0040_auto_20190315_1906.py deleted file mode 100644 index 9ce813b..0000000 --- a/app/jrnl/migrations/0040_auto_20190315_1906.py +++ /dev/null @@ -1,20 +0,0 @@ -# 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/jrnl/migrations/0041_auto_20190315_2240.py b/app/jrnl/migrations/0041_auto_20190315_2240.py deleted file mode 100644 index 06b9697..0000000 --- a/app/jrnl/migrations/0041_auto_20190315_2240.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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/jrnl/migrations/0042_auto_20190412_1805.py b/app/jrnl/migrations/0042_auto_20190412_1805.py deleted file mode 100644 index 71c0d51..0000000 --- a/app/jrnl/migrations/0042_auto_20190412_1805.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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/jrnl/migrations/0043_auto_20190704_0903.py b/app/jrnl/migrations/0043_auto_20190704_0903.py deleted file mode 100644 index 758499a..0000000 --- a/app/jrnl/migrations/0043_auto_20190704_0903.py +++ /dev/null @@ -1,21 +0,0 @@ -# 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/jrnl/migrations/0044_auto_20190917_1703.py b/app/jrnl/migrations/0044_auto_20190917_1703.py deleted file mode 100644 index c6e5d6c..0000000 --- a/app/jrnl/migrations/0044_auto_20190917_1703.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0045_entry_books_new.py b/app/jrnl/migrations/0045_entry_books_new.py deleted file mode 100644 index a941088..0000000 --- a/app/jrnl/migrations/0045_entry_books_new.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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/jrnl/migrations/0046_remove_entry_books.py b/app/jrnl/migrations/0046_remove_entry_books.py deleted file mode 100644 index bad9813..0000000 --- a/app/jrnl/migrations/0046_remove_entry_books.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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/jrnl/migrations/0047_auto_20191110_0859.py b/app/jrnl/migrations/0047_auto_20191110_0859.py deleted file mode 100644 index 28d3866..0000000 --- a/app/jrnl/migrations/0047_auto_20191110_0859.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0048_auto_20191205_1720.py b/app/jrnl/migrations/0048_auto_20191205_1720.py deleted file mode 100644 index 51be2f1..0000000 --- a/app/jrnl/migrations/0048_auto_20191205_1720.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0049_entry_newrelated.py b/app/jrnl/migrations/0049_entry_newrelated.py deleted file mode 100644 index 3bd8dee..0000000 --- a/app/jrnl/migrations/0049_entry_newrelated.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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/jrnl/migrations/0050_auto_20191206_0741.py b/app/jrnl/migrations/0050_auto_20191206_0741.py deleted file mode 100644 index b732b68..0000000 --- a/app/jrnl/migrations/0050_auto_20191206_0741.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0051_auto_20201027_2102.py b/app/jrnl/migrations/0051_auto_20201027_2102.py deleted file mode 100644 index 09d0dea..0000000 --- a/app/jrnl/migrations/0051_auto_20201027_2102.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0052_entry_new_field_notes.py b/app/jrnl/migrations/0052_entry_new_field_notes.py deleted file mode 100644 index 3ec3167..0000000 --- a/app/jrnl/migrations/0052_entry_new_field_notes.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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/jrnl/migrations/0053_auto_20201027_2105.py b/app/jrnl/migrations/0053_auto_20201027_2105.py deleted file mode 100644 index 904b6c2..0000000 --- a/app/jrnl/migrations/0053_auto_20201027_2105.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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/jrnl/migrations/0054_auto_20201111_2148.py b/app/jrnl/migrations/0054_auto_20201111_2148.py deleted file mode 100644 index bdeb63f..0000000 --- a/app/jrnl/migrations/0054_auto_20201111_2148.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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/jrnl/migrations/__init__.py b/app/jrnl/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/jrnl/models.py b/app/jrnl/models.py deleted file mode 100644 index f3c0626..0000000 --- a/app/jrnl/models.py +++ /dev/null @@ -1,309 +0,0 @@ -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/jrnl/templates/horizontal_select.html b/app/jrnl/templates/horizontal_select.html deleted file mode 100644 index 61dcfd8..0000000 --- a/app/jrnl/templates/horizontal_select.html +++ /dev/null @@ -1,17 +0,0 @@ -{% with id=widget.attrs.id %} - - {% for group, options, index in widget.optgroups %} - {% if group %} -
  • {{ group }} - - {% endif %} - {% for option in options %} -
  • {% include option.template_name with widget=option %}
  • - {% endfor %} - {% if group %} - - - {% endif %} - {% endfor %} - -{% endwith %} diff --git a/app/jrnl/templates/jrnl/entry_detail.html b/app/jrnl/templates/jrnl/entry_detail.html deleted file mode 100644 index 0904178..0000000 --- a/app/jrnl/templates/jrnl/entry_detail.html +++ /dev/null @@ -1,240 +0,0 @@ -{% 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%} - - - - - - - - - - - - - - - - - - - - - - -{%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 %} -
    -
    -
    -

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

    - {% if object.subtitle %}

    {{object.subtitle|smartypants|safe}}

    {%endif%} -
    - {% if object.location %}
    -

    {% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state_name|safe}}, U.S.{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name|safe}}{%endif%}

    - – Map -
    {%endif%} - - -
    -
    -
    - {{object.body_html|safe|smartypants}} -
    - {%if wildlife or object.field_notes.all or object.books.all %}{%endif%} -
    - {% with object.get_next_published as next %} - {% with object.get_previous_published as prev %} - - {% if object.related.all %}
    - -
    {%endif%} - - {% comment %}
    -
    If you enjoyed this, you should join the mailing list…
    - {% include 'mailing_list.html' %} -
    {% endcomment %} - {% if object.enable_comments %} -{% get_comment_count for object as comment_count %} -{%if comment_count > 0 %} -

    {{comment_count}} Comment{{ comment_count|pluralize }}

    -{% render_comment_list for object %} -{%endif%} -
    -{% render_comment_form for object %} -
    -{% else %} -

    Sorry, comments have been disabled for this post.

    -{%endif%} -
    -{% endblock %} -{% block js %} - -{%endblock%} diff --git a/app/jrnl/templates/jrnl/entry_detail.txt b/app/jrnl/templates/jrnl/entry_detail.txt deleted file mode 100644 index 547ce79..0000000 --- a/app/jrnl/templates/jrnl/entry_detail.txt +++ /dev/null @@ -1,8 +0,0 @@ -{{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/jrnl/templates/jrnl/entry_list.html b/app/jrnl/templates/jrnl/entry_list.html deleted file mode 100644 index 6eefe10..0000000 --- a/app/jrnl/templates/jrnl/entry_list.html +++ /dev/null @@ -1,33 +0,0 @@ -{% 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 %}
    -

    {% if region %}Journal entries from {%if region.name == 'United States'%}the United States{%else%}{{region.name|title|smartypants|safe}}{%endif%}{%else%}Journal {%endif%}

    {% autopaginate object_list 24 %} {% for object in object_list %} -
    -
    - {% if object.featured_image %} - {% include "lib/img_archive.html" with image=object.featured_image %} - {%else%} - {{ object.title }}{%endif%} -
    -

    {{object.title|safe|smartypants|widont}}

    - - -

    - - {% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state_name}}, U.S.{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name}}{%endif%} - – - - {{object.dek|safe}} - -

    -
    {% endfor %} -
    - -{% endblock %} diff --git a/app/jrnl/urls.py b/app/jrnl/urls.py deleted file mode 100644 index caf1935..0000000 --- a/app/jrnl/urls.py +++ /dev/null @@ -1,61 +0,0 @@ -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\d{4})/(?P\d{2})/(?P[-\w]+).txt$', - views.EntryDetailViewTXT.as_view(), - name="detail-txt" - ), - re_path( - r'^(?P\d{4})/(?P\d{2})/(?P[-\w]+)$', - views.EntryDetailView.as_view(), - name="detail" - ), - re_path( - r'^(?P[0-9]{4})/(?P[0-9]{2})/$', - views.EntryMonthArchiveView.as_view(month_format='%m'), - name="list_month" - ), - re_path( - r'(?P\d{4})/$', - views.EntryYearArchiveView.as_view(), - name="list_year" - ), - re_path( - r'^(?P\d+)/$', - views.EntryList.as_view(), - name="list" - ), - path( - r'latest/', - views.JrnlLatestView.as_view(), - name="latest" - ), - re_path( - r'(?P[-\w]+)/(?P\d+)/$', - views.EntryCountryList.as_view(), - name="list_country" - ), - re_path( - r'^(?P[-\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/jrnl/views.py b/app/jrnl/views.py deleted file mode 100644 index 6b7cc8d..0000000 --- a/app/jrnl/views.py +++ /dev/null @@ -1,165 +0,0 @@ -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 diff --git a/app/locations/build.py b/app/locations/build.py new file mode 100644 index 0000000..cf17c59 --- /dev/null +++ b/app/locations/build.py @@ -0,0 +1,12 @@ + + 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 map_builder(): + j = BuildJrnl("jrnl", "entry") + j.build_map() diff --git a/app/locations/views.py b/app/locations/views.py index bf6cd84..e5d580b 100644 --- a/app/locations/views.py +++ b/app/locations/views.py @@ -5,7 +5,7 @@ from django.views.generic.detail import DetailView from django.conf import settings from django.db.models import Q -from jrnl.models import Entry +from posts.models import Post #from projects.shortcuts import render_to_geojson from sightings.models import Sighting from utils.views import PaginatedListView @@ -13,7 +13,7 @@ from .models import Country, Region, Route, Location, Track def map_list(request): context = { - 'object_list': Entry.objects.filter(status__exact=1), + 'object_list': Post.objects.filter(status__exact=1), 'country_list': Country.objects.filter(visited=True).exclude(name='default'), 'route_list': Route.objects.all(), 'region_list': Region.objects.all() @@ -29,7 +29,7 @@ class MapList(ListView): Return list of Entries on map """ context_object_name = 'object_list' - queryset = Entry.objects.filter(status__exact=1) + queryset = Post.objects.filter(status__exact=1) template_name = 'archives/map.html' def get_context_data(self, **kwargs): @@ -47,7 +47,7 @@ class MapDataList(ListView): Build data file for Entries on map """ context_object_name = 'object_list' - queryset = Entry.objects.filter(status__exact=1) + queryset = Post.objects.filter(status__exact=1) template_name = 'archives/map_data.html' def get_context_data(self, **kwargs): @@ -61,7 +61,7 @@ class MapDataList(ListView): def map_data(request): context = { - 'object_list': Entry.objects.filter(status__exact=1), + 'object_list': Post.objects.filter(status__exact=1), 'route_list': Route.objects.all(), 'country_list': Country.objects.filter(visited=True).exclude(name='default'), 'region_list': Region.objects.all() @@ -90,7 +90,7 @@ class LocationDetail(DetailView): def get_context_data(self, **kwargs): context = super(LocationDetail, self).get_context_data(**kwargs) - context['entry_list'] = Entry.objects.filter( + context['entry_list'] = Post.objects.filter( Q(location=self.get_object()) | Q(location__in=Location.objects.filter(parent=self.get_object())) ) @@ -106,7 +106,7 @@ class TrackDetail(DetailView): def get_context_data(self, **kwargs): context = super(WalkDetail, self).get_context_data(**kwargs) - context['entry_list'] = Entry.objects.filter( + context['entry_list'] = Post.objects.filter( Q(location=self.get_object().location) | Q(location__in=Location.objects.filter(parent=self.get_object().location)) ) diff --git a/app/pages/admin.py b/app/pages/admin.py index 5cd2b23..4b4dcce 100644 --- a/app/pages/admin.py +++ b/app/pages/admin.py @@ -1,10 +1,11 @@ from django.contrib import admin +from utils.widgets import LGEntryForm from django import forms from django.forms import Textarea from django.db import models -from pages.models import Page +from pages.models import Page, HomePage class PageEntryForm(forms.ModelForm): @@ -16,6 +17,7 @@ class PageEntryForm(forms.ModelForm): } +@admin.register(Page) class PageAdmin(admin.ModelAdmin): form = PageEntryForm list_display = ('title', 'slug', 'path', 'app', 'build') @@ -32,4 +34,14 @@ class PageAdmin(admin.ModelAdmin): }) ) -admin.site.register(Page, PageAdmin) + +@admin.register(HomePage) +class HomePageAdmin(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/pages/migrations/0007_homepage.py b/app/pages/migrations/0007_homepage.py new file mode 100644 index 0000000..c11aae9 --- /dev/null +++ b/app/pages/migrations/0007_homepage.py @@ -0,0 +1,28 @@ +# Generated by Django 3.1 on 2020-11-14 09:30 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('posts', '0015_post_old_image'), + ('photos', '0019_auto_20190704_0903'), + ('pages', '0006_page_enable_comments'), + ] + + operations = [ + migrations.CreateModel( + name='HomePage', + 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, null=True)), + ('template_name', models.CharField(help_text='full path', max_length=200)), + ('featured', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='banner', to='posts.post')), + ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.luximage')), + ('popular', models.ManyToManyField(related_name='popular', to='posts.Post')), + ], + ), + ] diff --git a/app/pages/migrations/0008_auto_20201114_0934.py b/app/pages/migrations/0008_auto_20201114_0934.py new file mode 100644 index 0000000..e8465a6 --- /dev/null +++ b/app/pages/migrations/0008_auto_20201114_0934.py @@ -0,0 +1,30 @@ +# Generated by Django 3.1 on 2020-11-14 09:34 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0019_auto_20190704_0903'), + ('pages', '0007_homepage'), + ] + + operations = [ + migrations.AlterField( + model_name='homepage', + name='featured_image', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='photos.luximage'), + ), + migrations.AlterField( + model_name='homepage', + name='tag_line', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AlterField( + model_name='homepage', + name='template_name', + field=models.CharField(blank=True, help_text='full path', max_length=200, null=True), + ), + ] diff --git a/app/pages/models.py b/app/pages/models.py index 5e9cd5b..8caa29e 100644 --- a/app/pages/models.py +++ b/app/pages/models.py @@ -2,6 +2,8 @@ import re from django.db import models from django.contrib.sitemaps import Sitemap +from photos.models import LuxImage +from posts.models import Post from utils.util import markdown_to_html, render_images @@ -33,6 +35,19 @@ class Page(models.Model): super(Page, self).save() +class HomePage(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) + tag_line = models.CharField(max_length=200, null=True, blank=True) + featured = models.ForeignKey(Post, on_delete=models.CASCADE, related_name="banner") + popular = models.ManyToManyField(Post, related_name="popular") + template_name = models.CharField(max_length=200, help_text="full path", null=True, blank=True) + + class PageSitemap(Sitemap): changefreq = "never" priority = 1.0 diff --git a/app/pages/templates/pages/homepage.html b/app/pages/templates/pages/homepage.html new file mode 100644 index 0000000..c8075ea --- /dev/null +++ b/app/pages/templates/pages/homepage.html @@ -0,0 +1,98 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% block sitename %} + + Luxagraf: thoughts on ecology, culture, travel, photography, walking and other ephemera + {%endblock%} + + {%block extrahead%} + +{%endblock%} +{%block bodyid%}id="home" class="archive"{%endblock%} + +{% block primary %} +
    +

    About Luxagraf

    + map of travels +

    We’re a family of five living full time in a vintage 1969 Dodge Travco motorhome. We’ve been at it for three years now. People always ask: What's it like for five people to live in a 26ft RV? Why do we live this way?

    +

    The short answer is simple: because we like it and we can. If you want more than a soundbite, read through the journal. If you like it, sign up for the newsletter, Friends of a Long Year. I'd also subscribe to the RSS feed, but that's just me.

    +
    + +
    +
    Browse the Archives
    +
    +{% endblock %} + +{% block js %}{% comment %} {% endcomment%}{% endblock%} diff --git a/app/pages/views.py b/app/pages/views.py index 167ad01..ed8d380 100644 --- a/app/pages/views.py +++ b/app/pages/views.py @@ -1,6 +1,9 @@ from utils.views import LuxDetailView +from django.views.generic import DetailView -from .models import Page +from locations.models import LuxCheckIn +from posts.models import Post, PostType +from .models import Page, HomePage class PageDetailView(LuxDetailView): @@ -15,3 +18,22 @@ class PageDetailTXTView(LuxDetailView): model = Page slug_field = "slug" template_name = "pages/page_detail.txt" + + +class HomePageList(DetailView): + """ + Return a main entry and list of Entries in reverse chronological order + """ + model = HomePage + + def get_template_names(self): + return ["pages/%s.html" % self.template_name, 'pages/homepage.html'] + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(HomePageList, self).get_context_data(**kwargs) + context['object_list'] = Post.objects.filter(post_type=PostType.JRNL).filter(status__exact=1).order_by('-pub_date').exclude().select_related('location').select_related('featured_image')[1:9] + context['location'] = LuxCheckIn.objects.latest() + return context + + diff --git a/app/posts/build.py b/app/posts/build.py index 73c52e2..8c8fee0 100644 --- a/app/posts/build.py +++ b/app/posts/build.py @@ -20,11 +20,6 @@ class BuildSrc(BuildNew): self.build_detail_view() -def src_builder(): - j = BuildSrc("posts", "post") - j.build() - - class BuildGuide(BuildNew): def get_model_queryset(self): @@ -38,11 +33,6 @@ class BuildGuide(BuildNew): self.build_detail_view() -def guide_builder(): - j = BuildGuide("posts", "post") - j.build() - - class BuildFieldNotes(BuildNew): def get_model_queryset(self): @@ -58,6 +48,68 @@ class BuildFieldNotes(BuildNew): self.build_month_view("fieldnotes:list_month") -def fieldnotes_builder(): - j = BuildFieldNotes("posts", "post") - j.build() +class BuildJrnl(BuildNew): + ''' + Write jrnl to disk + ''' + def get_model_queryset(self): + return self.model.objects.filter(post_type=PostType.JRNL).filter(status__exact=1).order_by('-pub_date') + + 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_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_latest(self): + response = self.client.get('/jrnl/latest/') + self.write_file(reverse("jrnl:latest"), response.content) + + +class BuildHome(BuildNew): + + def build(self): + response = self.client.get('/') + self.write_file('', response.content) diff --git a/app/posts/migrations/0001_initial.py b/app/posts/migrations/0001_initial.py index e853a06..3c36ee9 100644 --- a/app/posts/migrations/0001_initial.py +++ b/app/posts/migrations/0001_initial.py @@ -11,12 +11,10 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('jrnl', '0044_auto_20190917_1703'), ('books', '0009_book_afflink'), ('normalize', '__first__'), ('taxonomy', '0001_initial'), ('locations', '0018_auto_20190414_2124'), - ('fieldnotes', '0002_auto_20190303_1222'), ('photos', '0019_auto_20190704_0903'), ] diff --git a/app/posts/templates/posts/jrnl_detail.txt b/app/posts/templates/posts/jrnl_detail.txt index 547ce79..a608b88 100644 --- a/app/posts/templates/posts/jrnl_detail.txt +++ b/app/posts/templates/posts/jrnl_detail.txt @@ -2,7 +2,7 @@ {% 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/posts/templates/posts/jrnl_latest.html b/app/posts/templates/posts/jrnl_latest.html new file mode 100644 index 0000000..03e3c56 --- /dev/null +++ b/app/posts/templates/posts/jrnl_latest.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% block js %} + +{% endblock %} diff --git a/app/posts/views/jrnl_views.py b/app/posts/views/jrnl_views.py index 1ff7a4c..0dc2dc8 100644 --- a/app/posts/views/jrnl_views.py +++ b/app/posts/views/jrnl_views.py @@ -121,7 +121,7 @@ class JrnlDetailViewTXT(JrnlDetailView): class JrnlLatestView(JrnlDetailView): - template_name = "details/entry_latest.html" + template_name = "posts/jrnl_latest.html" def get_object(self, queryset=None): obj = self.model.objects.filter(status=1).latest() diff --git a/app/publications/__init__.py b/app/publications/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/publications/admin.py b/app/publications/admin.py deleted file mode 100644 index 15456d5..0000000 --- a/app/publications/admin.py +++ /dev/null @@ -1,85 +0,0 @@ -from django.contrib import admin -from utils.widgets import LGEntryForm - -from .models import Publication, Editor, Pitch, Section, PitchIdea - - -@admin.register(Publication) -class PublicationAdmin(admin.ModelAdmin): - form = LGEntryForm - list_display = ('name', 'status') - list_filter = ('status',) - search_fields = ['name'] - fieldsets = ( - ('', { - 'fields': ( - 'name', - 'url', - 'notes', - ('section', 'tags'), - ('pays', 'pays_amount'), - ('submission_period_start', 'submission_period_end'), - 'status' - ), - 'classes': ('show', 'extrapretty', 'wide') - }), - ) - - -@admin.register(Editor) -class EditorAdmin(admin.ModelAdmin): - list_display = ('last_name', 'first_name', 'publication', 'sections') - list_filter = ('publication', 'section') - search_fields = ['first_name', 'last_name', 'publication__name', 'section'] - filter_horizontal = ('section',) - - def sections(self, obj): - return [section for section in obj.section.all()] - sections.boolean = False - - fieldsets = ( - ('', { - 'fields': ('first_name', 'last_name', 'email', 'publication', 'section', 'notes', 'phone', 'twitter'), - 'classes': ('show', 'extrapretty', 'wide') - }), - ) - - -@admin.register(Pitch) -class PitchAdmin(admin.ModelAdmin): - list_display = ('title', 'date_sent', 'accepted', 'editor', 'publication') - list_filter = ('editor__publication', 'editor__section') - - def publication(self, obj): - return obj.editor.publication - publication.boolean = False - - fieldsets = ( - ('', { - 'fields': ('title', 'pitch', 'editor', 'accepted', 'date_sent'), - 'classes': ('show', 'extrapretty', 'wide') - }), - ) - - -@admin.register(PitchIdea) -class PitchIdeaAdmin(admin.ModelAdmin): - list_display = ('title', ) - - fieldsets = ( - ('', { - 'fields': ('title', 'pitch', 'publication'), - 'classes': ('show', 'extrapretty', 'wide') - }), - ) - - -@admin.register(Section) -class SectionAdmin(admin.ModelAdmin): - list_display = ('name',) - fieldsets = ( - ('', { - 'fields': ('name',), - 'classes': ('show', 'extrapretty', 'wide') - }), - ) diff --git a/app/publications/migrations/0001_initial.py b/app/publications/migrations/0001_initial.py deleted file mode 100644 index 9212571..0000000 --- a/app/publications/migrations/0001_initial.py +++ /dev/null @@ -1,73 +0,0 @@ -# Generated by Django 2.1.1 on 2019-01-31 08:56 - -from django.db import migrations, models -import django.db.models.deletion -import taggit.managers - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('taxonomy', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='Editor', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('first_name', models.CharField(max_length=250)), - ('last_name', models.CharField(max_length=250)), - ('email', models.CharField(blank=True, max_length=250)), - ('phone', models.CharField(blank=True, max_length=250)), - ('twitter', models.CharField(blank=True, max_length=250)), - ('slug', models.SlugField(blank=True)), - ('notes', models.TextField(blank=True)), - ('date_created', models.DateTimeField(auto_now_add=True)), - ('date_updated', models.DateTimeField(auto_now=True)), - ], - options={ - 'ordering': ('-last_name', '-date_created'), - }, - ), - migrations.CreateModel( - name='Pitch', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=250)), - ('pitch', models.TextField()), - ('slug', models.SlugField(blank=True)), - ('accepted', models.BooleanField(blank=True, null=True)), - ('date_sent', models.DateTimeField(blank=True, null=True)), - ('date_created', models.DateTimeField(auto_now_add=True)), - ('date_updated', models.DateTimeField(auto_now=True)), - ('editor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='publications.Editor')), - ], - options={ - 'ordering': ('-title', '-date_sent'), - }, - ), - migrations.CreateModel( - name='Publication', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=250)), - ('slug', models.SlugField(blank=True, unique_for_date='pub_date')), - ('notes', models.TextField(blank=True)), - ('status', models.IntegerField(choices=[(0, 'Have Published With'), (1, 'Published')], default=0)), - ('date_created', models.DateTimeField(auto_now_add=True)), - ('date_updated', models.DateTimeField(auto_now=True)), - ('tags', taggit.managers.TaggableManager(blank=True, help_text='Topics Covered', through='taxonomy.TaggedItems', to='taxonomy.LuxTag', verbose_name='Tags')), - ], - options={ - 'ordering': ('-name', '-date_created'), - }, - ), - migrations.AddField( - model_name='editor', - name='publication', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='publications.Publication'), - ), - ] diff --git a/app/publications/migrations/0002_editor_section.py b/app/publications/migrations/0002_editor_section.py deleted file mode 100644 index a4675ae..0000000 --- a/app/publications/migrations/0002_editor_section.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.1 on 2019-01-31 09:00 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('publications', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='editor', - name='section', - field=models.CharField(blank=True, max_length=50), - ), - ] diff --git a/app/publications/migrations/0003_auto_20190131_0923.py b/app/publications/migrations/0003_auto_20190131_0923.py deleted file mode 100644 index 6844c55..0000000 --- a/app/publications/migrations/0003_auto_20190131_0923.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 2.1.1 on 2019-01-31 09:23 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('publications', '0002_editor_section'), - ] - - operations = [ - migrations.CreateModel( - name='Section', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=250)), - ('slug', models.SlugField(blank=True)), - ('date_created', models.DateTimeField(auto_now_add=True)), - ('date_updated', models.DateTimeField(auto_now=True)), - ], - ), - migrations.RemoveField( - model_name='editor', - name='section', - ), - migrations.AlterField( - model_name='publication', - name='status', - field=models.IntegerField(choices=[(0, 'Not Published'), (1, 'Published')], default=0), - ), - migrations.AddField( - model_name='editor', - name='section', - field=models.ManyToManyField(blank=True, to='publications.Section'), - ), - ] diff --git a/app/publications/migrations/0004_pitchidea.py b/app/publications/migrations/0004_pitchidea.py deleted file mode 100644 index db72d58..0000000 --- a/app/publications/migrations/0004_pitchidea.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 2.1.1 on 2019-01-31 10:46 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('publications', '0003_auto_20190131_0923'), - ] - - operations = [ - migrations.CreateModel( - name='PitchIdea', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=250)), - ('pitch', models.TextField()), - ('date_created', models.DateTimeField(auto_now_add=True)), - ('date_updated', models.DateTimeField(auto_now=True)), - ('publication', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='publications.Publication')), - ], - options={ - 'ordering': ('-title', '-date_created'), - }, - ), - ] diff --git a/app/publications/migrations/0005_auto_20190131_1100.py b/app/publications/migrations/0005_auto_20190131_1100.py deleted file mode 100644 index a800dcf..0000000 --- a/app/publications/migrations/0005_auto_20190131_1100.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 2.1.1 on 2019-01-31 11:00 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('publications', '0004_pitchidea'), - ] - - operations = [ - migrations.AddField( - model_name='publication', - name='section', - field=models.ManyToManyField(blank=True, to='publications.Section'), - ), - migrations.AddField( - model_name='publication', - name='url', - field=models.CharField(blank=True, max_length=250), - ), - ] diff --git a/app/publications/migrations/0006_auto_20190222_1819.py b/app/publications/migrations/0006_auto_20190222_1819.py deleted file mode 100644 index 8c779dd..0000000 --- a/app/publications/migrations/0006_auto_20190222_1819.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-22 18:19 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('publications', '0005_auto_20190131_1100'), - ] - - operations = [ - migrations.AddField( - model_name='publication', - name='pays', - field=models.BooleanField(default=True), - ), - migrations.AddField( - model_name='publication', - name='pays_amount', - field=models.CharField(blank=True, max_length=100), - ), - migrations.AddField( - model_name='publication', - name='submission_period_end', - field=models.DateField(blank=True, null=True), - ), - migrations.AddField( - model_name='publication', - name='submission_period_start', - field=models.DateField(blank=True, null=True), - ), - ] diff --git a/app/publications/migrations/__init__.py b/app/publications/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/publications/models.py b/app/publications/models.py deleted file mode 100644 index 05f7267..0000000 --- a/app/publications/models.py +++ /dev/null @@ -1,133 +0,0 @@ -from django.contrib.gis.db import models -from django.utils import timezone -from django.utils.text import slugify -from django.urls import reverse - -from taggit.managers import TaggableManager - -from taxonomy.models import TaggedItems - - -class Section(models.Model): - """ Generic model for Categories """ - name = models.CharField(max_length=250) - slug = models.SlugField(blank=True) - date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) - date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) - - def __str__(self): - return self.name - - def save(self, *args, **kwargs): - if self._state.adding: - self.slug = slugify(self.name)[:50] - super(Section, self).save() - - -class Publication(models.Model): - name = models.CharField(max_length=250) - url = models.CharField(max_length=250, blank=True) - section = models.ManyToManyField(Section, blank=True) - slug = models.SlugField(unique_for_date='pub_date', blank=True) - notes = models.TextField(blank=True) - tags = TaggableManager(through=TaggedItems, blank=True, help_text='Topics Covered') - PUB_STATUS = ( - (0, 'Not Published'), - (1, 'Published'), - ) - status = models.IntegerField(choices=PUB_STATUS, default=0) - date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) - date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) - pays = models.BooleanField(default=True) - pays_amount = models.CharField(max_length=100, blank=True) - submission_period_start = models.DateField(blank=True, null=True) - submission_period_end = models.DateField(blank=True, null=True) - - class Meta: - ordering = ('-name', '-date_created') - - def __str__(self): - return self.name - - def get_absolute_url(self): - return reverse("publications:pub-detail", kwargs={"slug": self.slug}) - - def save(self, *args, **kwargs): - if not self.id: - self.date_created = timezone.now() - self.date_updated = timezone.now() - super(Publication, self).save() - - -class Editor(models.Model): - first_name = models.CharField(max_length=250) - last_name = models.CharField(max_length=250) - email = models.CharField(max_length=250, blank=True) - phone = models.CharField(max_length=250, blank=True) - twitter = models.CharField(max_length=250, blank=True) - slug = models.SlugField(blank=True) - notes = models.TextField(blank=True) - publication = models.ForeignKey(Publication, on_delete=models.SET_NULL, blank=True, null=True) - section = models.ManyToManyField(Section, blank=True) - date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) - date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) - - class Meta: - ordering = ('-last_name', '-date_created') - - def __str__(self): - return "{0} {1}".format(self.first_name, self.last_name) - - def get_absolute_url(self): - return reverse("publications:pub-detail", kwargs={"slug": self.slug}) - - def save(self, *args, **kwargs): - if self._state.adding: - self.slug = slugify('%s %s' % (self.first_name, self.last_name))[:50] - self.date_created = timezone.now() - self.date_updated = timezone.now() - super(Editor, self).save() - - -class Pitch(models.Model): - title = models.CharField(max_length=250) - pitch = models.TextField() - slug = models.SlugField(blank=True) - editor = models.ForeignKey(Editor, on_delete=models.SET_NULL, blank=True, null=True) - accepted = models.BooleanField(null=True, blank=True) - date_sent = models.DateTimeField(blank=True, null=True) - date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) - date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) - - class Meta: - ordering = ('-title', '-date_sent') - - def __str__(self): - return self.title - - def save(self, *args, **kwargs): - if self._state.adding: - self.slug = slugify(self.title)[:50] - self.date_created = timezone.now() - self.date_updated = timezone.now() - super(Pitch, self).save() - - -class PitchIdea(models.Model): - title = models.CharField(max_length=250) - pitch = models.TextField() - publication = models.ForeignKey(Publication, on_delete=models.SET_NULL, blank=True, null=True) - date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) - date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) - - class Meta: - ordering = ('-title', '-date_created') - - def __str__(self): - return self.title - - def save(self, *args, **kwargs): - if self._state.adding: - self.date_created = timezone.now() - self.date_updated = timezone.now() - super(PitchIdea, self).save() diff --git a/app/publications/urls.py b/app/publications/urls.py deleted file mode 100644 index 3f43b32..0000000 --- a/app/publications/urls.py +++ /dev/null @@ -1,24 +0,0 @@ -from django.urls import path - -from . import views - -app_name = "publications" - -urlpatterns = [ - path( - r'', - views.PubListView.as_view(), - {'page': 1}, - name="list" - ), - path( - r'/', - views.PubListView.as_view(), - name="list" - ), - path( - r'', - views.PubsDetailView.as_view(), - name="pub-detail" - ), -] diff --git a/app/publications/views.py b/app/publications/views.py deleted file mode 100644 index 0398dcb..0000000 --- a/app/publications/views.py +++ /dev/null @@ -1,20 +0,0 @@ -from django.views.generic.detail import DetailView - -from utils.views import PaginatedListView - -from .models import Publication - - -class PubListView(PaginatedListView): - """ - Return a list of Publications - """ - queryset = Publication.objects.all() - - -class PubDetailView(DetailView): - """ - Return a detail view of Publication - """ - model = Publication - slug_field = "slug" diff --git a/app/taxonomy/migrations/0004_auto_20201114_0757.py b/app/taxonomy/migrations/0004_auto_20201114_0757.py new file mode 100644 index 0000000..8cc9de2 --- /dev/null +++ b/app/taxonomy/migrations/0004_auto_20201114_0757.py @@ -0,0 +1,35 @@ +# Generated by Django 3.1 on 2020-11-14 07:57 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('taxonomy', '0003_category_pluralized_name'), + ] + + operations = [ + migrations.AlterField( + model_name='luxtag', + name='name', + field=models.CharField(max_length=100, unique=True, verbose_name='name'), + ), + migrations.AlterField( + model_name='luxtag', + name='slug', + field=models.SlugField(max_length=100, unique=True, verbose_name='slug'), + ), + migrations.AlterField( + model_name='taggeditems', + name='content_type', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='taxonomy_taggeditems_tagged_items', to='contenttypes.contenttype', verbose_name='content type'), + ), + migrations.AlterField( + model_name='taggeditems', + name='object_id', + field=models.IntegerField(db_index=True, verbose_name='object ID'), + ), + ] diff --git a/app/unused_apps/fieldnotes_/__init__.py b/app/unused_apps/fieldnotes_/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/unused_apps/fieldnotes_/admin.py b/app/unused_apps/fieldnotes_/admin.py new file mode 100644 index 0000000..838063d --- /dev/null +++ b/app/unused_apps/fieldnotes_/admin.py @@ -0,0 +1,38 @@ +from django.contrib import admin +from django.contrib.contenttypes.admin import GenericTabularInline + +from .models import FieldNote +from utils.widgets import LGEntryForm, OLAdminBase +from utils.util import get_latlon + + +@admin.register(FieldNote) +class NoteAdmin(OLAdminBase): + form = LGEntryForm + prepopulated_fields = {"slug": ('title',)} + list_display = ('title', 'slug', 'pub_date', 'location') + fieldsets = ( + ('Note', { + 'fields': ( + ('title', 'note_type'), + 'subtitle', + 'body_markdown', + 'slug', + ('pub_date', 'status'), + 'point' + ), + 'classes': ( + 'show', + 'extrapretty', + 'wide' + ) + } + ), + ) + lat, lon = get_latlon() + default_lon = lon + default_lat = lat + default_zoom = 10 + + class Media: + js = ('image-loader.js', 'next-prev-links.js') diff --git a/app/unused_apps/fieldnotes_/build.py b/app/unused_apps/fieldnotes_/build.py new file mode 100644 index 0000000..4c5c83b --- /dev/null +++ b/app/unused_apps/fieldnotes_/build.py @@ -0,0 +1,36 @@ +import os +from django.urls import reverse +from builder.base import BuildNew + + +class BuildNotes(BuildNew): + + def build(self): + self.build_detail_view() + self.build_list_view( + base_path=reverse("fieldnotes:list"), + paginate_by=24 + ) + self.build_year_view("fieldnotes:list_year") + self.build_month_view("fieldnotes:list_month") + + def get_model_queryset(self): + return self.model.objects.all() + + def build_detail_view(self): + ''' + write out all the expenses for each trip + ''' + for obj in self.get_model_queryset(): + url = obj.get_absolute_url() + path, slug = os.path.split(url) + path = '%s/' % path + # write html + response = self.client.get(url) + print(path, slug) + self.write_file(path, response.content, filename=slug) + + +def builder(): + j = BuildNotes("fieldnotes", "fieldnote") + j.build() diff --git a/app/unused_apps/fieldnotes_/migrations/0001_initial.py b/app/unused_apps/fieldnotes_/migrations/0001_initial.py new file mode 100644 index 0000000..cec67fb --- /dev/null +++ b/app/unused_apps/fieldnotes_/migrations/0001_initial.py @@ -0,0 +1,37 @@ +# Generated by Django 2.1.7 on 2019-03-03 12:13 + +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): + + initial = True + + dependencies = [ + ('locations', '0017_auto_20190217_1849'), + ] + + operations = [ + migrations.CreateModel( + name='FieldNote', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(blank=True, max_length=250)), + ('subtitle', models.CharField(blank=True, max_length=250)), + ('slug', models.SlugField(blank=True, unique_for_date='pub_date')), + ('pub_date', models.DateTimeField(default=django.utils.timezone.now)), + ('body_html', models.TextField(blank=True)), + ('body_markdown', models.TextField(verbose_name='Note')), + ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)), + ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=1)), + ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), + ], + options={ + 'get_latest_by': 'pub_date', + 'ordering': ('-pub_date',), + }, + ), + ] diff --git a/app/unused_apps/fieldnotes_/migrations/0002_auto_20190303_1222.py b/app/unused_apps/fieldnotes_/migrations/0002_auto_20190303_1222.py new file mode 100644 index 0000000..c0e352e --- /dev/null +++ b/app/unused_apps/fieldnotes_/migrations/0002_auto_20190303_1222.py @@ -0,0 +1,25 @@ +# Generated by Django 2.1.7 on 2019-03-03 12:22 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0018_auto_20161130_1218'), + ('fieldnotes', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='fieldnote', + name='featured_image', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='photos.LuxImage'), + ), + migrations.AddField( + model_name='fieldnote', + name='note_type', + field=models.IntegerField(choices=[(0, 'Note'), (1, 'Photo')], default=0), + ), + ] diff --git a/app/unused_apps/fieldnotes_/migrations/__init__.py b/app/unused_apps/fieldnotes_/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/unused_apps/fieldnotes_/models.py b/app/unused_apps/fieldnotes_/models.py new file mode 100644 index 0000000..c14ba80 --- /dev/null +++ b/app/unused_apps/fieldnotes_/models.py @@ -0,0 +1,113 @@ +import re +from django import forms +from django.contrib.gis.db import models +from django.utils import timezone +from django.urls import reverse +from django.conf import settings +from django.contrib.sitemaps import Sitemap + +from locations.models import Location, CheckIn +from photos.models import LuxImage +from utils.util import render_images, parse_image, markdown_to_html, extract_main_image + + +def render_images(s): + s = re.sub('', parse_image, s) + return s + + +class FieldNote(models.Model): + title = models.CharField(max_length=250, blank=True) + subtitle = models.CharField(max_length=250, blank=True) + slug = models.SlugField(unique_for_date='pub_date', blank=True) + pub_date = models.DateTimeField(default=timezone.now) + body_html = models.TextField(blank=True) + body_markdown = models.TextField('Note') + point = models.PointField(blank=True, null=True) + location = models.ForeignKey(Location, on_delete=models.CASCADE, blank=True, null=True) + PUB_STATUS = ( + (0, 'Draft'), + (1, 'Published'), + ) + status = models.IntegerField(choices=PUB_STATUS, default=1) + NOTE_TYPE = ( + (0, 'Note'), + (1, 'Photo'), + ) + note_type = models.IntegerField(choices=NOTE_TYPE, default=0) + featured_image = models.ForeignKey(LuxImage, on_delete=models.SET_NULL, blank=True, null=True) + + class Meta: + ordering = ('-pub_date',) + get_latest_by = 'pub_date' + + def __str__(self): + return self.title + + def get_absolute_url(self): + return reverse("fieldnotes:detail", kwargs={"year": self.pub_date.year, "month": self.pub_date.strftime("%m"), "slug": self.slug}) + + def get_object_type(self): + return 'fieldnote' + + @property + def region(self): + return self.location.lux_region + + @property + def longitude(self): + '''Get the site's longitude.''' + return round(self.point.x, 2) + + @property + def latitude(self): + '''Get the site's latitude.''' + return round(self.point.y, 2) + + @property + def get_previous_published(self): + return self.get_previous_by_pub_date() + + @property + def get_next_published(self): + return self.get_next_by_pub_date() + + @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_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 save(self, *args, **kwargs): + md = render_images(self.body_markdown) + self.body_html = markdown_to_html(md) + if not self.point: + self.point = CheckIn.objects.latest().point + 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 not self.id: + self.pub_date = timezone.now() + self.date_last_updated = timezone.now() + self.featured_image = extract_main_image(self.body_markdown) + super(FieldNote, self).save() + + +class FieldNoteSitemap(Sitemap): + changefreq = "never" + priority = 0.7 + protocol = "https" + + def items(self): + return FieldNote.objects.filter(status=1) + + def lastmod(self, obj): + return obj.pub_date diff --git a/app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_archive_list_date.html b/app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_archive_list_date.html new file mode 100644 index 0000000..5d6865f --- /dev/null +++ b/app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_archive_list_date.html @@ -0,0 +1,43 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load html5_datetime %} +{% block pagetitle %} Field Notes | luxagraf {% endblock %} +{% block metadescription %} Rough notes and sketches from the field {% endblock %} +{%block bodyid%}id="field-notes"{%endblock%} + +{% block primary %} + +
    +
    +

    Field Notes {% if month or year %}{% if month %} from {{month|date:"F"}} {{month|date:"Y"}}{%else%} from {{year|date:"Y"}}{%endif%}{%endif%}

    +

    Quick notes, sketches and images from the road. This is the semi-orgnized brain dump that comes before the more organized journal entries and essays. If I used social media this is the stuff I'd probably put there, but I prefer to put it here, even if it means a lot few people read it.

    +
    + +
    + +{% endblock %} + + + diff --git a/app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_detail.html b/app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_detail.html new file mode 100644 index 0000000..d1c648b --- /dev/null +++ b/app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_detail.html @@ -0,0 +1,95 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load html5_datetime %} +{% load month_number_to_name %} +{% block pagetitle %}{{object.title|title|smartypants|safe}} - Luxagraf, Field Notes{% endblock %} + +{% block metadescription %}{{object.body_html|striptags|safe|truncatewords:30}}{% endblock %} +{%block extrahead%} + + + + + +{%endblock%} +{% block bodyid %}class="notes--permalin detail" id="archive-{% if month %}{{month|month_number_to_name}}{%endif%}{{year}}"{%endblock%} +{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} +{% block primary %}
    +
    +
    +

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

    + {% if object.subtitle %}

    {{object.subtitle|smartypants|safe}}

    {%endif%} +
    + {% if object.location %}
    +

    {% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state_name|safe}}, U.S.{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name|safe}}{%endif%}

    + – Map +
    {%endif%} + + +
    +
    +
    + {{object.body_html|safe|smartypants}} +
    + + + + + + + + {% with object.get_next_published as next %} + {% with object.get_previous_published as prev %} + {%endwith%}{%endwith%} +
    +
    +{% endblock %} + +{% block js %} + +{%endblock%} diff --git a/app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_list.html b/app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_list.html new file mode 100644 index 0000000..37cd0ca --- /dev/null +++ b/app/unused_apps/fieldnotes_/templates/fieldnotes/fieldnote_list.html @@ -0,0 +1,49 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load get_next %} +{% load html5_datetime %} +{% load pagination_tags %} +{% block pagetitle %} Field Notes | luxagraf {% endblock %} +{% block metadescription %}Rough notes and sketches from the field {% endblock %} +{%block bodyid%}id="field-notes"{%endblock%} +{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} +{% block primary %}
    +
    +

    Field Notes

    +

    Quick notes, sketches, and images from the road. This is the semi-organized brain dump that comes before the more organized journal entries. If I used social media this is the stuff I'd probably put there, but I prefer to put it here, even if it means a lot fewer people read it.

    +
    + {% autopaginate object_list 30 %} + +
    + +{% endblock %} + + + diff --git a/app/unused_apps/fieldnotes_/urls.py b/app/unused_apps/fieldnotes_/urls.py new file mode 100644 index 0000000..85ee710 --- /dev/null +++ b/app/unused_apps/fieldnotes_/urls.py @@ -0,0 +1,39 @@ +from django.urls import path, re_path + +from . import views + +app_name = "field notes" + +urlpatterns = [ + re_path( + r'(?P[0-9]{4})/$', + views.FieldNoteYearArchiveView.as_view(), + name="list_year" + ), + path( + r'', + views.FieldNoteListView.as_view(), + {'page': 1}, + name="list" + ), + path( + r'/', + views.FieldNoteListView.as_view(), + name="list" + ), + path( + r'//.txt', + views.FieldNoteDetailViewTXT.as_view(), + name="detail-txt" + ), + path( + r'//', + views.FieldNoteDetailView.as_view(), + name="detail" + ), + path( + r'//', + views.FieldNoteMonthArchiveView.as_view(month_format='%m'), + name="list_month" + ), +] diff --git a/app/unused_apps/fieldnotes_/views.py b/app/unused_apps/fieldnotes_/views.py new file mode 100644 index 0000000..9b49cc0 --- /dev/null +++ b/app/unused_apps/fieldnotes_/views.py @@ -0,0 +1,37 @@ +from django.views.generic.dates import YearArchiveView, MonthArchiveView +from django.views.generic.detail import DetailView + +from utils.views import PaginatedListView, LuxDetailView + +from .models import FieldNote + + +class FieldNoteListView(PaginatedListView): + model = FieldNote + """ + Return a list of Notes in reverse chronological order + """ + queryset = FieldNote.objects.filter(status=1).order_by('-pub_date') + + +class FieldNoteDetailView(LuxDetailView): + model = FieldNote + slug_field = "slug" + + +class FieldNoteDetailViewTXT(FieldNoteDetailView): + template_name = "jrnl/entry.txt" + + +class FieldNoteYearArchiveView(YearArchiveView): + queryset = FieldNote.objects.filter(status=1) + date_field = "pub_date" + template_name = "fieldnotes/fieldnote_archive_list_date.html" + make_object_list = True + + +class FieldNoteMonthArchiveView(MonthArchiveView): + queryset = FieldNote.objects.filter(status=1) + date_field = "pub_date" + make_object_list = True + template_name = "fieldnotes/fieldnote_archive_list_date.html" diff --git a/app/unused_apps/jrnl/__init__.py b/app/unused_apps/jrnl/__init__.py new file mode 100644 index 0000000..e69de29 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(''): + 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 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 %} + + {% for group, options, index in widget.optgroups %} + {% if group %} +
  • {{ group }} + + {% endif %} + {% for option in options %} +
  • {% include option.template_name with widget=option %}
  • + {% endfor %} + {% if group %} + + + {% endif %} + {% endfor %} + +{% 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%} + + + + + + + + + + + + + + + + + + + + + + +{%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 %} +
    +
    +
    +

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

    + {% if object.subtitle %}

    {{object.subtitle|smartypants|safe}}

    {%endif%} +
    + {% if object.location %}
    +

    {% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state_name|safe}}, U.S.{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name|safe}}{%endif%}

    + – Map +
    {%endif%} + + +
    +
    +
    + {{object.body_html|safe|smartypants}} +
    + {%if wildlife or object.field_notes.all or object.books.all %}{%endif%} +
    + {% with object.get_next_published as next %} + {% with object.get_previous_published as prev %} + + {% if object.related.all %}
    + +
    {%endif%} + + {% comment %}
    +
    If you enjoyed this, you should join the mailing list…
    + {% include 'mailing_list.html' %} +
    {% endcomment %} + {% if object.enable_comments %} +{% get_comment_count for object as comment_count %} +{%if comment_count > 0 %} +

    {{comment_count}} Comment{{ comment_count|pluralize }}

    +{% render_comment_list for object %} +{%endif%} +
    +{% render_comment_form for object %} +
    +{% else %} +

    Sorry, comments have been disabled for this post.

    +{%endif%} +
    +{% endblock %} +{% block js %} + +{%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 %}
    +

    {% if region %}Journal entries from {%if region.name == 'United States'%}the United States{%else%}{{region.name|title|smartypants|safe}}{%endif%}{%else%}Journal {%endif%}

    {% autopaginate object_list 24 %} {% for object in object_list %} +
    +
    + {% if object.featured_image %} + {% include "lib/img_archive.html" with image=object.featured_image %} + {%else%} + {{ object.title }}{%endif%} +
    +

    {{object.title|safe|smartypants|widont}}

    + + +

    + + {% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state_name}}, U.S.{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name}}{%endif%} + – + + {{object.dek|safe}} + +

    +
    {% endfor %} +
    + +{% 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\d{4})/(?P\d{2})/(?P[-\w]+).txt$', + views.EntryDetailViewTXT.as_view(), + name="detail-txt" + ), + re_path( + r'^(?P\d{4})/(?P\d{2})/(?P[-\w]+)$', + views.EntryDetailView.as_view(), + name="detail" + ), + re_path( + r'^(?P[0-9]{4})/(?P[0-9]{2})/$', + views.EntryMonthArchiveView.as_view(month_format='%m'), + name="list_month" + ), + re_path( + r'(?P\d{4})/$', + views.EntryYearArchiveView.as_view(), + name="list_year" + ), + re_path( + r'^(?P\d+)/$', + views.EntryList.as_view(), + name="list" + ), + path( + r'latest/', + views.JrnlLatestView.as_view(), + name="latest" + ), + re_path( + r'(?P[-\w]+)/(?P\d+)/$', + views.EntryCountryList.as_view(), + name="list_country" + ), + re_path( + r'^(?P[-\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 diff --git a/app/unused_apps/publications/__init__.py b/app/unused_apps/publications/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/unused_apps/publications/admin.py b/app/unused_apps/publications/admin.py new file mode 100644 index 0000000..15456d5 --- /dev/null +++ b/app/unused_apps/publications/admin.py @@ -0,0 +1,85 @@ +from django.contrib import admin +from utils.widgets import LGEntryForm + +from .models import Publication, Editor, Pitch, Section, PitchIdea + + +@admin.register(Publication) +class PublicationAdmin(admin.ModelAdmin): + form = LGEntryForm + list_display = ('name', 'status') + list_filter = ('status',) + search_fields = ['name'] + fieldsets = ( + ('', { + 'fields': ( + 'name', + 'url', + 'notes', + ('section', 'tags'), + ('pays', 'pays_amount'), + ('submission_period_start', 'submission_period_end'), + 'status' + ), + 'classes': ('show', 'extrapretty', 'wide') + }), + ) + + +@admin.register(Editor) +class EditorAdmin(admin.ModelAdmin): + list_display = ('last_name', 'first_name', 'publication', 'sections') + list_filter = ('publication', 'section') + search_fields = ['first_name', 'last_name', 'publication__name', 'section'] + filter_horizontal = ('section',) + + def sections(self, obj): + return [section for section in obj.section.all()] + sections.boolean = False + + fieldsets = ( + ('', { + 'fields': ('first_name', 'last_name', 'email', 'publication', 'section', 'notes', 'phone', 'twitter'), + 'classes': ('show', 'extrapretty', 'wide') + }), + ) + + +@admin.register(Pitch) +class PitchAdmin(admin.ModelAdmin): + list_display = ('title', 'date_sent', 'accepted', 'editor', 'publication') + list_filter = ('editor__publication', 'editor__section') + + def publication(self, obj): + return obj.editor.publication + publication.boolean = False + + fieldsets = ( + ('', { + 'fields': ('title', 'pitch', 'editor', 'accepted', 'date_sent'), + 'classes': ('show', 'extrapretty', 'wide') + }), + ) + + +@admin.register(PitchIdea) +class PitchIdeaAdmin(admin.ModelAdmin): + list_display = ('title', ) + + fieldsets = ( + ('', { + 'fields': ('title', 'pitch', 'publication'), + 'classes': ('show', 'extrapretty', 'wide') + }), + ) + + +@admin.register(Section) +class SectionAdmin(admin.ModelAdmin): + list_display = ('name',) + fieldsets = ( + ('', { + 'fields': ('name',), + 'classes': ('show', 'extrapretty', 'wide') + }), + ) diff --git a/app/unused_apps/publications/migrations/0001_initial.py b/app/unused_apps/publications/migrations/0001_initial.py new file mode 100644 index 0000000..9212571 --- /dev/null +++ b/app/unused_apps/publications/migrations/0001_initial.py @@ -0,0 +1,73 @@ +# Generated by Django 2.1.1 on 2019-01-31 08:56 + +from django.db import migrations, models +import django.db.models.deletion +import taggit.managers + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('taxonomy', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Editor', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('first_name', models.CharField(max_length=250)), + ('last_name', models.CharField(max_length=250)), + ('email', models.CharField(blank=True, max_length=250)), + ('phone', models.CharField(blank=True, max_length=250)), + ('twitter', models.CharField(blank=True, max_length=250)), + ('slug', models.SlugField(blank=True)), + ('notes', models.TextField(blank=True)), + ('date_created', models.DateTimeField(auto_now_add=True)), + ('date_updated', models.DateTimeField(auto_now=True)), + ], + options={ + 'ordering': ('-last_name', '-date_created'), + }, + ), + migrations.CreateModel( + name='Pitch', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=250)), + ('pitch', models.TextField()), + ('slug', models.SlugField(blank=True)), + ('accepted', models.BooleanField(blank=True, null=True)), + ('date_sent', models.DateTimeField(blank=True, null=True)), + ('date_created', models.DateTimeField(auto_now_add=True)), + ('date_updated', models.DateTimeField(auto_now=True)), + ('editor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='publications.Editor')), + ], + options={ + 'ordering': ('-title', '-date_sent'), + }, + ), + migrations.CreateModel( + name='Publication', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=250)), + ('slug', models.SlugField(blank=True, unique_for_date='pub_date')), + ('notes', models.TextField(blank=True)), + ('status', models.IntegerField(choices=[(0, 'Have Published With'), (1, 'Published')], default=0)), + ('date_created', models.DateTimeField(auto_now_add=True)), + ('date_updated', models.DateTimeField(auto_now=True)), + ('tags', taggit.managers.TaggableManager(blank=True, help_text='Topics Covered', through='taxonomy.TaggedItems', to='taxonomy.LuxTag', verbose_name='Tags')), + ], + options={ + 'ordering': ('-name', '-date_created'), + }, + ), + migrations.AddField( + model_name='editor', + name='publication', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='publications.Publication'), + ), + ] diff --git a/app/unused_apps/publications/migrations/0002_editor_section.py b/app/unused_apps/publications/migrations/0002_editor_section.py new file mode 100644 index 0000000..a4675ae --- /dev/null +++ b/app/unused_apps/publications/migrations/0002_editor_section.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.1 on 2019-01-31 09:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('publications', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='editor', + name='section', + field=models.CharField(blank=True, max_length=50), + ), + ] diff --git a/app/unused_apps/publications/migrations/0003_auto_20190131_0923.py b/app/unused_apps/publications/migrations/0003_auto_20190131_0923.py new file mode 100644 index 0000000..6844c55 --- /dev/null +++ b/app/unused_apps/publications/migrations/0003_auto_20190131_0923.py @@ -0,0 +1,37 @@ +# Generated by Django 2.1.1 on 2019-01-31 09:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('publications', '0002_editor_section'), + ] + + operations = [ + migrations.CreateModel( + name='Section', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=250)), + ('slug', models.SlugField(blank=True)), + ('date_created', models.DateTimeField(auto_now_add=True)), + ('date_updated', models.DateTimeField(auto_now=True)), + ], + ), + migrations.RemoveField( + model_name='editor', + name='section', + ), + migrations.AlterField( + model_name='publication', + name='status', + field=models.IntegerField(choices=[(0, 'Not Published'), (1, 'Published')], default=0), + ), + migrations.AddField( + model_name='editor', + name='section', + field=models.ManyToManyField(blank=True, to='publications.Section'), + ), + ] diff --git a/app/unused_apps/publications/migrations/0004_pitchidea.py b/app/unused_apps/publications/migrations/0004_pitchidea.py new file mode 100644 index 0000000..db72d58 --- /dev/null +++ b/app/unused_apps/publications/migrations/0004_pitchidea.py @@ -0,0 +1,28 @@ +# Generated by Django 2.1.1 on 2019-01-31 10:46 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('publications', '0003_auto_20190131_0923'), + ] + + operations = [ + migrations.CreateModel( + name='PitchIdea', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=250)), + ('pitch', models.TextField()), + ('date_created', models.DateTimeField(auto_now_add=True)), + ('date_updated', models.DateTimeField(auto_now=True)), + ('publication', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='publications.Publication')), + ], + options={ + 'ordering': ('-title', '-date_created'), + }, + ), + ] diff --git a/app/unused_apps/publications/migrations/0005_auto_20190131_1100.py b/app/unused_apps/publications/migrations/0005_auto_20190131_1100.py new file mode 100644 index 0000000..a800dcf --- /dev/null +++ b/app/unused_apps/publications/migrations/0005_auto_20190131_1100.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1.1 on 2019-01-31 11:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('publications', '0004_pitchidea'), + ] + + operations = [ + migrations.AddField( + model_name='publication', + name='section', + field=models.ManyToManyField(blank=True, to='publications.Section'), + ), + migrations.AddField( + model_name='publication', + name='url', + field=models.CharField(blank=True, max_length=250), + ), + ] diff --git a/app/unused_apps/publications/migrations/0006_auto_20190222_1819.py b/app/unused_apps/publications/migrations/0006_auto_20190222_1819.py new file mode 100644 index 0000000..8c779dd --- /dev/null +++ b/app/unused_apps/publications/migrations/0006_auto_20190222_1819.py @@ -0,0 +1,33 @@ +# Generated by Django 2.1.5 on 2019-02-22 18:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('publications', '0005_auto_20190131_1100'), + ] + + operations = [ + migrations.AddField( + model_name='publication', + name='pays', + field=models.BooleanField(default=True), + ), + migrations.AddField( + model_name='publication', + name='pays_amount', + field=models.CharField(blank=True, max_length=100), + ), + migrations.AddField( + model_name='publication', + name='submission_period_end', + field=models.DateField(blank=True, null=True), + ), + migrations.AddField( + model_name='publication', + name='submission_period_start', + field=models.DateField(blank=True, null=True), + ), + ] diff --git a/app/unused_apps/publications/migrations/__init__.py b/app/unused_apps/publications/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/unused_apps/publications/models.py b/app/unused_apps/publications/models.py new file mode 100644 index 0000000..05f7267 --- /dev/null +++ b/app/unused_apps/publications/models.py @@ -0,0 +1,133 @@ +from django.contrib.gis.db import models +from django.utils import timezone +from django.utils.text import slugify +from django.urls import reverse + +from taggit.managers import TaggableManager + +from taxonomy.models import TaggedItems + + +class Section(models.Model): + """ Generic model for Categories """ + name = models.CharField(max_length=250) + slug = models.SlugField(blank=True) + date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) + date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) + + def __str__(self): + return self.name + + def save(self, *args, **kwargs): + if self._state.adding: + self.slug = slugify(self.name)[:50] + super(Section, self).save() + + +class Publication(models.Model): + name = models.CharField(max_length=250) + url = models.CharField(max_length=250, blank=True) + section = models.ManyToManyField(Section, blank=True) + slug = models.SlugField(unique_for_date='pub_date', blank=True) + notes = models.TextField(blank=True) + tags = TaggableManager(through=TaggedItems, blank=True, help_text='Topics Covered') + PUB_STATUS = ( + (0, 'Not Published'), + (1, 'Published'), + ) + status = models.IntegerField(choices=PUB_STATUS, default=0) + date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) + date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) + pays = models.BooleanField(default=True) + pays_amount = models.CharField(max_length=100, blank=True) + submission_period_start = models.DateField(blank=True, null=True) + submission_period_end = models.DateField(blank=True, null=True) + + class Meta: + ordering = ('-name', '-date_created') + + def __str__(self): + return self.name + + def get_absolute_url(self): + return reverse("publications:pub-detail", kwargs={"slug": self.slug}) + + def save(self, *args, **kwargs): + if not self.id: + self.date_created = timezone.now() + self.date_updated = timezone.now() + super(Publication, self).save() + + +class Editor(models.Model): + first_name = models.CharField(max_length=250) + last_name = models.CharField(max_length=250) + email = models.CharField(max_length=250, blank=True) + phone = models.CharField(max_length=250, blank=True) + twitter = models.CharField(max_length=250, blank=True) + slug = models.SlugField(blank=True) + notes = models.TextField(blank=True) + publication = models.ForeignKey(Publication, on_delete=models.SET_NULL, blank=True, null=True) + section = models.ManyToManyField(Section, blank=True) + date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) + date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) + + class Meta: + ordering = ('-last_name', '-date_created') + + def __str__(self): + return "{0} {1}".format(self.first_name, self.last_name) + + def get_absolute_url(self): + return reverse("publications:pub-detail", kwargs={"slug": self.slug}) + + def save(self, *args, **kwargs): + if self._state.adding: + self.slug = slugify('%s %s' % (self.first_name, self.last_name))[:50] + self.date_created = timezone.now() + self.date_updated = timezone.now() + super(Editor, self).save() + + +class Pitch(models.Model): + title = models.CharField(max_length=250) + pitch = models.TextField() + slug = models.SlugField(blank=True) + editor = models.ForeignKey(Editor, on_delete=models.SET_NULL, blank=True, null=True) + accepted = models.BooleanField(null=True, blank=True) + date_sent = models.DateTimeField(blank=True, null=True) + date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) + date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) + + class Meta: + ordering = ('-title', '-date_sent') + + def __str__(self): + return self.title + + def save(self, *args, **kwargs): + if self._state.adding: + self.slug = slugify(self.title)[:50] + self.date_created = timezone.now() + self.date_updated = timezone.now() + super(Pitch, self).save() + + +class PitchIdea(models.Model): + title = models.CharField(max_length=250) + pitch = models.TextField() + publication = models.ForeignKey(Publication, on_delete=models.SET_NULL, blank=True, null=True) + date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) + date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) + + class Meta: + ordering = ('-title', '-date_created') + + def __str__(self): + return self.title + + def save(self, *args, **kwargs): + if self._state.adding: + self.date_created = timezone.now() + self.date_updated = timezone.now() + super(PitchIdea, self).save() diff --git a/app/unused_apps/publications/urls.py b/app/unused_apps/publications/urls.py new file mode 100644 index 0000000..3f43b32 --- /dev/null +++ b/app/unused_apps/publications/urls.py @@ -0,0 +1,24 @@ +from django.urls import path + +from . import views + +app_name = "publications" + +urlpatterns = [ + path( + r'', + views.PubListView.as_view(), + {'page': 1}, + name="list" + ), + path( + r'/', + views.PubListView.as_view(), + name="list" + ), + path( + r'', + views.PubsDetailView.as_view(), + name="pub-detail" + ), +] diff --git a/app/unused_apps/publications/views.py b/app/unused_apps/publications/views.py new file mode 100644 index 0000000..0398dcb --- /dev/null +++ b/app/unused_apps/publications/views.py @@ -0,0 +1,20 @@ +from django.views.generic.detail import DetailView + +from utils.views import PaginatedListView + +from .models import Publication + + +class PubListView(PaginatedListView): + """ + Return a list of Publications + """ + queryset = Publication.objects.all() + + +class PubDetailView(DetailView): + """ + Return a detail view of Publication + """ + model = Publication + slug_field = "slug" -- cgit v1.2.3-70-g09d2