summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/jrnl/migrations/0054_auto_20201111_2148.py23
-rw-r--r--app/jrnl/models.py3
-rw-r--r--app/unused_apps/income/__init__.py (renamed from app/income/__init__.py)0
-rw-r--r--app/unused_apps/income/admin.py (renamed from app/income/admin.py)0
-rw-r--r--app/unused_apps/income/migrations/0001_initial.py (renamed from app/income/migrations/0001_initial.py)0
-rw-r--r--app/unused_apps/income/migrations/0002_gig_due_date.py (renamed from app/income/migrations/0002_gig_due_date.py)0
-rw-r--r--app/unused_apps/income/migrations/0003_auto_20161213_1038.py (renamed from app/income/migrations/0003_auto_20161213_1038.py)0
-rw-r--r--app/unused_apps/income/migrations/0004_invoice_invoiceitem.py (renamed from app/income/migrations/0004_invoice_invoiceitem.py)0
-rw-r--r--app/unused_apps/income/migrations/0005_invoice_slug.py (renamed from app/income/migrations/0005_invoice_slug.py)0
-rw-r--r--app/unused_apps/income/migrations/0006_auto_20190131_2351.py (renamed from app/income/migrations/0006_auto_20190131_2351.py)0
-rw-r--r--app/unused_apps/income/migrations/__init__.py (renamed from app/income/migrations/__init__.py)0
-rw-r--r--app/unused_apps/income/models.py (renamed from app/income/models.py)0
-rw-r--r--app/unused_apps/income/parser.py (renamed from app/income/parser.py)0
-rw-r--r--app/unused_apps/income/views.py (renamed from app/income/views.py)0
-rw-r--r--app/unused_apps/people/__init__.py (renamed from app/people/__init__.py)0
-rw-r--r--app/unused_apps/people/admin.py (renamed from app/people/admin.py)0
-rw-r--r--app/unused_apps/people/build.py (renamed from app/people/build.py)0
-rw-r--r--app/unused_apps/people/migrations/0001_initial.py (renamed from app/people/migrations/0001_initial.py)0
-rw-r--r--app/unused_apps/people/migrations/__init__.py (renamed from app/people/migrations/__init__.py)0
-rw-r--r--app/unused_apps/people/models.py (renamed from app/people/models.py)0
-rw-r--r--app/unused_apps/people/urls.py (renamed from app/people/urls.py)0
-rw-r--r--app/unused_apps/people/views.py (renamed from app/people/views.py)0
-rw-r--r--app/unused_apps/stuff/__init__.py (renamed from app/stuff/__init__.py)0
-rw-r--r--app/unused_apps/stuff/admin.py (renamed from app/stuff/admin.py)0
-rw-r--r--app/unused_apps/stuff/models.py (renamed from app/stuff/models.py)0
-rw-r--r--app/unused_apps/stuff/temp.py (renamed from app/stuff/temp.py)0
-rw-r--r--app/unused_apps/trips/__init__.py0
-rw-r--r--app/unused_apps/trips/admin.py34
-rw-r--r--app/unused_apps/trips/migrations/0001_initial.py31
-rw-r--r--app/unused_apps/trips/migrations/__init__.py0
-rw-r--r--app/unused_apps/trips/models.py40
-rw-r--r--app/unused_apps/trips/urls.py24
-rw-r--r--app/unused_apps/trips/views.py101
-rw-r--r--config/base_urls.py8
34 files changed, 258 insertions, 6 deletions
diff --git a/app/jrnl/migrations/0054_auto_20201111_2148.py b/app/jrnl/migrations/0054_auto_20201111_2148.py
new file mode 100644
index 0000000..bdeb63f
--- /dev/null
+++ b/app/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/jrnl/models.py b/app/jrnl/models.py
index 830a244..f3c0626 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -24,7 +24,6 @@ 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 fieldnotes.models import FieldNote
from posts.models import Post
from normalize.models import RelatedPost
@@ -78,7 +77,7 @@ class Entry(models.Model):
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)
+ #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)
diff --git a/app/income/__init__.py b/app/unused_apps/income/__init__.py
index e69de29..e69de29 100644
--- a/app/income/__init__.py
+++ b/app/unused_apps/income/__init__.py
diff --git a/app/income/admin.py b/app/unused_apps/income/admin.py
index b165371..b165371 100644
--- a/app/income/admin.py
+++ b/app/unused_apps/income/admin.py
diff --git a/app/income/migrations/0001_initial.py b/app/unused_apps/income/migrations/0001_initial.py
index 3a1e926..3a1e926 100644
--- a/app/income/migrations/0001_initial.py
+++ b/app/unused_apps/income/migrations/0001_initial.py
diff --git a/app/income/migrations/0002_gig_due_date.py b/app/unused_apps/income/migrations/0002_gig_due_date.py
index ccd0f73..ccd0f73 100644
--- a/app/income/migrations/0002_gig_due_date.py
+++ b/app/unused_apps/income/migrations/0002_gig_due_date.py
diff --git a/app/income/migrations/0003_auto_20161213_1038.py b/app/unused_apps/income/migrations/0003_auto_20161213_1038.py
index 559cd5a..559cd5a 100644
--- a/app/income/migrations/0003_auto_20161213_1038.py
+++ b/app/unused_apps/income/migrations/0003_auto_20161213_1038.py
diff --git a/app/income/migrations/0004_invoice_invoiceitem.py b/app/unused_apps/income/migrations/0004_invoice_invoiceitem.py
index 59f389c..59f389c 100644
--- a/app/income/migrations/0004_invoice_invoiceitem.py
+++ b/app/unused_apps/income/migrations/0004_invoice_invoiceitem.py
diff --git a/app/income/migrations/0005_invoice_slug.py b/app/unused_apps/income/migrations/0005_invoice_slug.py
index 3b6dfb2..3b6dfb2 100644
--- a/app/income/migrations/0005_invoice_slug.py
+++ b/app/unused_apps/income/migrations/0005_invoice_slug.py
diff --git a/app/income/migrations/0006_auto_20190131_2351.py b/app/unused_apps/income/migrations/0006_auto_20190131_2351.py
index 1c8f64c..1c8f64c 100644
--- a/app/income/migrations/0006_auto_20190131_2351.py
+++ b/app/unused_apps/income/migrations/0006_auto_20190131_2351.py
diff --git a/app/income/migrations/__init__.py b/app/unused_apps/income/migrations/__init__.py
index e69de29..e69de29 100644
--- a/app/income/migrations/__init__.py
+++ b/app/unused_apps/income/migrations/__init__.py
diff --git a/app/income/models.py b/app/unused_apps/income/models.py
index e5a351b..e5a351b 100644
--- a/app/income/models.py
+++ b/app/unused_apps/income/models.py
diff --git a/app/income/parser.py b/app/unused_apps/income/parser.py
index b19d039..b19d039 100644
--- a/app/income/parser.py
+++ b/app/unused_apps/income/parser.py
diff --git a/app/income/views.py b/app/unused_apps/income/views.py
index 1c34068..1c34068 100644
--- a/app/income/views.py
+++ b/app/unused_apps/income/views.py
diff --git a/app/people/__init__.py b/app/unused_apps/people/__init__.py
index e69de29..e69de29 100644
--- a/app/people/__init__.py
+++ b/app/unused_apps/people/__init__.py
diff --git a/app/people/admin.py b/app/unused_apps/people/admin.py
index ea0b463..ea0b463 100644
--- a/app/people/admin.py
+++ b/app/unused_apps/people/admin.py
diff --git a/app/people/build.py b/app/unused_apps/people/build.py
index 35fdb19..35fdb19 100644
--- a/app/people/build.py
+++ b/app/unused_apps/people/build.py
diff --git a/app/people/migrations/0001_initial.py b/app/unused_apps/people/migrations/0001_initial.py
index 6f21bea..6f21bea 100644
--- a/app/people/migrations/0001_initial.py
+++ b/app/unused_apps/people/migrations/0001_initial.py
diff --git a/app/people/migrations/__init__.py b/app/unused_apps/people/migrations/__init__.py
index e69de29..e69de29 100644
--- a/app/people/migrations/__init__.py
+++ b/app/unused_apps/people/migrations/__init__.py
diff --git a/app/people/models.py b/app/unused_apps/people/models.py
index 1a07b16..1a07b16 100644
--- a/app/people/models.py
+++ b/app/unused_apps/people/models.py
diff --git a/app/people/urls.py b/app/unused_apps/people/urls.py
index 0ae38eb..0ae38eb 100644
--- a/app/people/urls.py
+++ b/app/unused_apps/people/urls.py
diff --git a/app/people/views.py b/app/unused_apps/people/views.py
index 36c0657..36c0657 100644
--- a/app/people/views.py
+++ b/app/unused_apps/people/views.py
diff --git a/app/stuff/__init__.py b/app/unused_apps/stuff/__init__.py
index e69de29..e69de29 100644
--- a/app/stuff/__init__.py
+++ b/app/unused_apps/stuff/__init__.py
diff --git a/app/stuff/admin.py b/app/unused_apps/stuff/admin.py
index 135b17b..135b17b 100644
--- a/app/stuff/admin.py
+++ b/app/unused_apps/stuff/admin.py
diff --git a/app/stuff/models.py b/app/unused_apps/stuff/models.py
index 05a7f4f..05a7f4f 100644
--- a/app/stuff/models.py
+++ b/app/unused_apps/stuff/models.py
diff --git a/app/stuff/temp.py b/app/unused_apps/stuff/temp.py
index 2150563..2150563 100644
--- a/app/stuff/temp.py
+++ b/app/unused_apps/stuff/temp.py
diff --git a/app/unused_apps/trips/__init__.py b/app/unused_apps/trips/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/unused_apps/trips/__init__.py
diff --git a/app/unused_apps/trips/admin.py b/app/unused_apps/trips/admin.py
new file mode 100644
index 0000000..54991f6
--- /dev/null
+++ b/app/unused_apps/trips/admin.py
@@ -0,0 +1,34 @@
+from django.contrib import admin
+from django.contrib.gis.admin import OSMGeoAdmin
+
+from .models import Trip
+
+from utils.widgets import OLAdminBase
+from utils.util import get_latlon
+from utils.widgets import LGEntryForm
+
+@admin.register(Trip)
+class TripAdmin(OSMGeoAdmin):
+ list_display = ('title', 'slug')
+ prepopulated_fields = {'slug': ('title',)}
+ ordering = ('title',)
+ search_fields = ['title']
+ list_select_related = True
+ fieldsets = (
+ ('Trip', {
+ 'fields': (
+ 'title',
+ 'subtitle',
+ 'dek_markdown',
+ 'route',
+ 'slug',
+ 'start_date',
+ 'end_date',
+ 'pub_date',
+ ),
+ 'classes': (
+ 'show',
+ 'extrapretty'
+ )
+ }),
+ )
diff --git a/app/unused_apps/trips/migrations/0001_initial.py b/app/unused_apps/trips/migrations/0001_initial.py
new file mode 100644
index 0000000..3d3c222
--- /dev/null
+++ b/app/unused_apps/trips/migrations/0001_initial.py
@@ -0,0 +1,31 @@
+# Generated by Django 2.1.7 on 2019-06-15 09:17
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('locations', '0018_auto_20190414_2124'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Trip',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=50)),
+ ('subtitle', models.CharField(blank=True, max_length=200)),
+ ('slug', models.SlugField(unique_for_date='pub_date')),
+ ('dek_markdown', models.TextField()),
+ ('dek_html', models.TextField(blank=True, null=True)),
+ ('pub_date', models.DateTimeField(verbose_name='Date published')),
+ ('start_date', models.DateTimeField(verbose_name='Date started')),
+ ('end_date', models.DateTimeField(verbose_name='Date ended')),
+ ('route', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='locations.Route')),
+ ],
+ ),
+ ]
diff --git a/app/unused_apps/trips/migrations/__init__.py b/app/unused_apps/trips/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/unused_apps/trips/migrations/__init__.py
diff --git a/app/unused_apps/trips/models.py b/app/unused_apps/trips/models.py
new file mode 100644
index 0000000..76941f2
--- /dev/null
+++ b/app/unused_apps/trips/models.py
@@ -0,0 +1,40 @@
+import json
+import requests
+from django import forms
+from django.urls import reverse
+from django.apps import apps
+from django.contrib.gis.geos import GEOSGeometry, fromstr, MultiPolygon
+from django.contrib.gis.db import models
+from django.contrib.sitemaps import Sitemap
+from django.utils.safestring import mark_safe
+from django.utils import timezone
+from django.conf import settings
+
+from utils.util import render_images, extract_main_image, markdown_to_html
+from locations.models import Route
+
+
+class Trip(models.Model):
+ """Model to define trips"""
+ title = models.CharField(max_length=50)
+ subtitle = models.CharField(max_length=200, blank=True)
+ slug = models.SlugField(unique_for_date='pub_date')
+ dek_markdown = models.TextField()
+ dek_html = models.TextField(null=True, blank=True)
+ pub_date = models.DateTimeField('Date published')
+ start_date = models.DateTimeField('Date started')
+ end_date = models.DateTimeField('Date ended')
+ route = models.ForeignKey(Route, on_delete=models.CASCADE)
+
+ def get_absolute_url(self):
+ return "/trips/%s/" % (self.slug)
+
+ def __str__(self):
+ return self.title
+
+ def save(self, *args, **kwargs):
+ created = self.pk is None
+ if not created:
+ md = render_images(self.dek_markdown)
+ self.dek_html = markdown_to_html(md)
+ super(Trip, self).save(*args, **kwargs)
diff --git a/app/unused_apps/trips/urls.py b/app/unused_apps/trips/urls.py
new file mode 100644
index 0000000..205c450
--- /dev/null
+++ b/app/unused_apps/trips/urls.py
@@ -0,0 +1,24 @@
+from django.urls import path, re_path
+
+from . import views
+
+app_name = "trips"
+
+urlpatterns = [
+ path(
+ r'<str:slug>',
+ views.LocationDetail.as_view(),
+ name="location-detail"
+ ),
+ path(
+ r'mapdata/',
+ views.MapDataList.as_view(),
+ name="mapdata"
+ ),
+ re_path(r'data/(?P<id>\d+)/$', views.data_json),
+ path(
+ r'',
+ views.MapList.as_view(),
+ name="maplist"
+ ),
+]
diff --git a/app/unused_apps/trips/views.py b/app/unused_apps/trips/views.py
new file mode 100644
index 0000000..3a93c0d
--- /dev/null
+++ b/app/unused_apps/trips/views.py
@@ -0,0 +1,101 @@
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+from django.views.generic import ListView
+from django.views.generic.detail import DetailView
+from django.conf import settings
+from django.db.models import Q
+
+from jrnl.models import Entry
+from projects.shortcuts import render_to_geojson
+from sightings.models import Sighting
+
+from .models import Country, Region, Route, Location
+
+def map_list(request):
+ context = {
+ 'object_list': Entry.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()
+ }
+ return render_to_response(
+ 'archives/map.html',
+ context,
+ context_instance=RequestContext(request)
+ )
+
+class MapList(ListView):
+ """
+ Return list of Entries on map
+ """
+ context_object_name = 'object_list'
+ queryset = Entry.objects.filter(status__exact=1)
+ template_name = 'archives/map.html'
+
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(MapList, self).get_context_data(**kwargs)
+ context['country_list'] = Country.objects.filter(visited=True).exclude(name='default'),
+ context['route_list'] = Route.objects.all(),
+ context['region_list'] = Region.objects.all()
+ context['IMAGES_URL'] = settings.IMAGES_URL
+ return context
+
+
+class MapDataList(ListView):
+ """
+ Build data file for Entries on map
+ """
+ context_object_name = 'object_list'
+ queryset = Entry.objects.filter(status__exact=1)
+ template_name = 'archives/map_data.html'
+
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(MapDataList, self).get_context_data(**kwargs)
+ context['country_list'] = Country.objects.filter(visited=True).exclude(name='default'),
+ context['route_list'] = Route.objects.all(),
+ context['region_list'] = Region.objects.all()
+ context['IMAGES_URL'] = settings.IMAGES_URL
+ return context
+
+def map_data(request):
+ context = {
+ 'object_list': Entry.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()
+ }
+ return render_to_response(
+ 'archives/map_data.html',
+ context,
+ context_instance=RequestContext(request)
+ )
+
+
+def data_json(request, id):
+ qs = Route.objects.filter(pk=id)
+ return render_to_geojson(
+ qs,
+ included_fields=['id', ],
+ geom_attribute='geometry',
+ mimetype='application/json',
+ pretty_print=True
+ )
+
+
+class LocationDetail(DetailView):
+ model = Location
+ template_name = "details/location.html"
+
+ def get_context_data(self, **kwargs):
+ context = super(LocationDetail, self).get_context_data(**kwargs)
+ context['entry_list'] = Entry.objects.filter(
+ Q(location=self.get_object()) |
+ Q(location__in=Location.objects.filter(parent=self.get_object()))
+ )
+ context['sighting_list'] = Sighting.objects.filter(
+ Q(location=self.get_object()) |
+ Q(location__in=Location.objects.filter(parent=self.get_object()))
+ ).order_by('ap_id', 'ap__apclass__kind').distinct("ap")
+ return context
diff --git a/config/base_urls.py b/config/base_urls.py
index 906f7e6..989a876 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -17,7 +17,7 @@ import utils.views
import products.views
from locations.views import MapDataList
-from income.views import MonthlyInvoiceView, DownloadMonthlyInvoiceView
+#from income.views import MonthlyInvoiceView, DownloadMonthlyInvoiceView
from posts.views import PostRSSFeedView
admin.autodiscover()
@@ -32,8 +32,8 @@ sitemaps = {
urlpatterns = [
re_path(r'^admin/build/.*', builder.views.do_build),
path(r'admin/data/', include('utils.urls')),
- path(r'admin/income/invoice/monthlyview/<str:slug>/invoice/', DownloadMonthlyInvoiceView.as_view(), name="download-invoice"),
- path(r'admin/income/invoice/monthlyview/<str:slug>/', MonthlyInvoiceView.as_view(), name="monthly-invoice"),
+ #path(r'admin/income/invoice/monthlyview/<str:slug>/invoice/', DownloadMonthlyInvoiceView.as_view(), name="download-invoice"),
+ #path(r'admin/income/invoice/monthlyview/<str:slug>/', MonthlyInvoiceView.as_view(), name="monthly-invoice"),
path(r'admin/', admin.site.urls),
path(r'luximages/insert/', utils.views.insert_image),
path(r'luxproduct/insert/', products.views.insert_products),
@@ -54,7 +54,7 @@ urlpatterns = [
re_path(r'^essay/$', RedirectView.as_view(url='/essays/')),
path(r'essays/', include('posts.urls.essay_urls', namespace='essay-list')),
path(r'book-notes/', include('books.urls')),
- path(r'people/', include('people.urls')),
+ #path(r'people/', include('people.urls')),
path(r'dialogues/', include('sightings.urls', namespace='sightings')),
path(r'field-notes/', include('posts.urls.field_note_urls', namespace='fieldnote')),
path(r'src/', include('posts.urls.src_urls', namespace='src')),