summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/builder/views.py4
-rw-r--r--app/lib/django_comments/abstracts.py2
-rw-r--r--app/lib/django_comments/models.py2
-rw-r--r--app/lib/pagination/templates/pagination/pagination.html2
-rw-r--r--app/lib/pagination/templatetags/pagination_tags.py6
-rw-r--r--app/locations/views.py10
-rw-r--r--app/photos/models.py5
-rw-r--r--app/photos/views.py13
-rw-r--r--app/projects/views.py6
-rw-r--r--app/utils/views.py4
-rw-r--r--design/templates/admin/index.html2
-rw-r--r--design/templates/base.html11
12 files changed, 36 insertions, 31 deletions
diff --git a/app/builder/views.py b/app/builder/views.py
index 7491b32..a32d384 100644
--- a/app/builder/views.py
+++ b/app/builder/views.py
@@ -1,4 +1,4 @@
-from django.shortcuts import render_to_response
+from django.shortcuts import render
from django.template import RequestContext
from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap
from src.build import builder as src_builder
@@ -82,4 +82,4 @@ def do_build(request):
else:
options[section]().build()
context = {'message': 'Writing %s to Disk' % section}
- return render_to_response('admin/message.html', context)
+ return render(request, 'admin/message.html', context)
diff --git a/app/lib/django_comments/abstracts.py b/app/lib/django_comments/abstracts.py
index 4fbb94a..f4ff362 100644
--- a/app/lib/django_comments/abstracts.py
+++ b/app/lib/django_comments/abstracts.py
@@ -6,7 +6,7 @@ from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.db import models
from django.utils import timezone
-from django.utils.encoding import python_2_unicode_compatible
+from six import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
try:
from django.urls import reverse
diff --git a/app/lib/django_comments/models.py b/app/lib/django_comments/models.py
index ebf1bc5..204cf2e 100644
--- a/app/lib/django_comments/models.py
+++ b/app/lib/django_comments/models.py
@@ -1,7 +1,7 @@
+from six import python_2_unicode_compatible
from django.conf import settings
from django.db import models
from django.utils import timezone
-from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from .abstracts import (
diff --git a/app/lib/pagination/templates/pagination/pagination.html b/app/lib/pagination/templates/pagination/pagination.html
index e2f8e42..0a7f9a4 100644
--- a/app/lib/pagination/templates/pagination/pagination.html
+++ b/app/lib/pagination/templates/pagination/pagination.html
@@ -1,6 +1,6 @@
{% load pagination_tags %}{% if is_paginated %}
<ul class="pages">{% if page_obj.has_previous %}
- <li><a href="{% page_path prev_page %}" class="prev"> Newer</a></li>{% endif %}{% for page in pages %}{% if page %}{% if page == page_obj.number %}
+ <li><a href="{% if prev_page == 1%}/{{request.base_path}}/{%else%}{% page_path prev_page %}{%endif%}" class="prev"> Newer</a></li>{% endif %}{% for page in pages %}{% if page %}{% if page == page_obj.number %}
<li class="current page">{{ page }}</li>{% else %}
<li><a href="{% if page == 1%}/{{request.base_path}}/{%else%}{% page_path page %}{%endif%}" class="page">{{ page }}</a></li>{% endif %}{% else %}
<li>...</li>{% endif %}{% endfor %}{% if page_obj.has_next %}
diff --git a/app/lib/pagination/templatetags/pagination_tags.py b/app/lib/pagination/templatetags/pagination_tags.py
index 75c23f6..0356f1f 100644
--- a/app/lib/pagination/templatetags/pagination_tags.py
+++ b/app/lib/pagination/templatetags/pagination_tags.py
@@ -5,7 +5,7 @@ except NameError:
import re
from django import template
from django.db.models.query import QuerySet
-from django.core.paginator import Paginator, QuerySetPaginator, InvalidPage
+from django.core.paginator import Paginator, InvalidPage
register = template.Library()
@@ -21,7 +21,7 @@ def page_path(parser, token):
raise template.TemplateSyntaxError(
'page_path requires a page template var'
)
-
+
return PagePathNode(bits[1])
class PagePathNode(template.Node):
@@ -99,7 +99,7 @@ class AutoPaginateNode(template.Node):
value = self.queryset_var.resolve(context)
if issubclass(value.__class__, QuerySet):
model = value.model
- paginator_class = QuerySetPaginator
+ paginator_class = Paginator
else:
value = list(value)
try:
diff --git a/app/locations/views.py b/app/locations/views.py
index a6d9ea1..06f7838 100644
--- a/app/locations/views.py
+++ b/app/locations/views.py
@@ -1,4 +1,4 @@
-from django.shortcuts import render_to_response
+from django.shortcuts import render
from django.template import RequestContext
from django.views.generic import ListView
from django.views.generic.detail import DetailView
@@ -18,10 +18,10 @@ def map_list(request):
'route_list': Route.objects.all(),
'region_list': Region.objects.all()
}
- return render_to_response(
+ return render(
+ request,
'archives/map.html',
context,
- context_instance=RequestContext(request)
)
class MapList(ListView):
@@ -66,10 +66,10 @@ def map_data(request):
'country_list': Country.objects.filter(visited=True).exclude(name='default'),
'region_list': Region.objects.all()
}
- return render_to_response(
+ return render(
+ request,
'archives/map_data.html',
context,
- context_instance=RequestContext(request)
)
diff --git a/app/photos/models.py b/app/photos/models.py
index 4bf3759..075808d 100644
--- a/app/photos/models.py
+++ b/app/photos/models.py
@@ -153,8 +153,9 @@ class LuxImage(models.Model):
return "%soriginal/%s/%s.%s" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), base, self.get_image_ext())
else:
if size != 'tn':
- s = LuxImageSize.objects.get(name=size)
- if s not in self.sizes.all():
+ try:
+ self.sizes.filter(name=size)
+ except DoesNotExist:
print("new size is "+s.name)
self.sizes.add(s)
return "%s%s/%s_%s.%s" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), base, size, self.get_image_ext())
diff --git a/app/photos/views.py b/app/photos/views.py
index 915b022..070b40d 100644
--- a/app/photos/views.py
+++ b/app/photos/views.py
@@ -1,5 +1,5 @@
import json
-from django.shortcuts import render_to_response, render
+from django.shortcuts import render
from django.template import RequestContext
from django.http import Http404, HttpResponse
from django.core import serializers
@@ -64,11 +64,18 @@ class OldGalleryList(PaginatedListView):
class DailyPhotoList(PaginatedListView):
+ model=LuxImage
template_name = 'archives/photo_daily_list.html'
def get_queryset(self):
return LuxImage.objects.filter(is_public=True, title__startswith="daily_")
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(DailyPhotoList, self).get_context_data(**kwargs)
+ context['breadcrumbs'] = ['daily',]
+ return context
+
def gallery_list(request, page):
request.page_url = '/photos/%d/'
@@ -84,7 +91,7 @@ def gallery(request, slug):
context = {
'object': PhotoGallery.objects.get(set_slug=slug)
}
- return render_to_response('details/photo_galleries.html', context, context_instance=RequestContext(request))
+ return render(request, 'details/photo_galleries.html', context)
def photo_json(request, slug):
@@ -127,4 +134,4 @@ def gallery_list_by_area(request, slug, page):
'region': region,
'page': page
}
- return render_to_response("archives/photos.html", context, context_instance=RequestContext(request))
+ return render(request, "archives/photos.html", context)
diff --git a/app/projects/views.py b/app/projects/views.py
index 23500e0..ad5f167 100644
--- a/app/projects/views.py
+++ b/app/projects/views.py
@@ -1,4 +1,4 @@
-from django.shortcuts import render_to_response, get_object_or_404
+from django.shortcuts import render, get_object_or_404
from django.template import RequestContext
from django.apps import apps
@@ -26,12 +26,12 @@ def detail(request, slug):
"object_list": qs,
}
template = 'details/%s.html' % (slug)
- return render_to_response(template, context, context_instance=RequestContext(request))
+ return render(request, template, context)
def gif_detail(request, slug):
obj = get_object_or_404(AnimatedGif, slug__exact=slug)
- return render_to_response('details/gifs.html', {'object': obj}, context_instance=RequestContext(request))
+ return render(request, 'details/gifs.html', {'object': obj})
def data_json(request, id):
diff --git a/app/utils/views.py b/app/utils/views.py
index d4c9eae..db8cb35 100644
--- a/app/utils/views.py
+++ b/app/utils/views.py
@@ -4,7 +4,6 @@ from django.urls import reverse
from django.http import Http404, HttpResponse
from django.views.generic import ListView, DetailView
from django.apps import apps
-from django.shortcuts import render_to_response
from django.shortcuts import render
from django.template import RequestContext
@@ -16,7 +15,8 @@ BREADCRUMBS = {
'SrcPost':'SRC',
'Book':'Book Notes',
'Entry':'Jrnl',
- 'NewsletterMailing':'lttr'
+ 'NewsletterMailing':'lttr',
+ 'LuxImage':'lttr'
}
class PaginatedListView(ListView):
diff --git a/design/templates/admin/index.html b/design/templates/admin/index.html
index e797eb2..f8c4fb2 100644
--- a/design/templates/admin/index.html
+++ b/design/templates/admin/index.html
@@ -1,5 +1,5 @@
{% extends "admin/base_site.html" %}
-{% load i18n admin_static %}
+{% load admin_list static i18n %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}" />
<style>
diff --git a/design/templates/base.html b/design/templates/base.html
index 2a80f4e..6a74d54 100644
--- a/design/templates/base.html
+++ b/design/templates/base.html
@@ -32,11 +32,9 @@
</div>
<nav>
<ul>
- <li><a href="/jrnl/" title="Stories of life on the road.">Jrnl</a></li>
- <!--<li><a href="/guides/" title="Advice, Tools, Tips and Tricks for Full Time Van or RV Life.">Guides</a></li>-->
- <!--<li><a href="/essays/" title="longer essays and posts about non-travel related things">Essays</a></li>-->
- <!--<li><a href="/field-notes/" title="Short stories, snapshots of daily life on the road.">Notes</a></li>-->
- <li><a href="/newsletter/" title="The 'friends of a long year' newsletter">Lttr</a></li>
+ <li><a href="{% url "jrnl:list" %}" title="Stories of life on the road.">Jrnl</a> &amp; <a href="{% url "fieldnotes:list" %}" title="Short stories, snapshots of daily life on the road.">Field Notes</a></li>
+ <li><a href="{% url "guide:guide-base" %}" title="Advice, Tools, Tips and Tricks for Full Time Van or RV Life.">Guides</a></li>
+ <li><a href="/newsletter/" title="The 'friends of a long year' newsletter">newsletter</a></li>
<li><a href="/about" title="About Scott">About</a></li>
</ul>
</nav>
@@ -54,8 +52,7 @@
<ul>
<li><a href="/jrnl/feed.xml" title="RSS feed">RSS</a></li>
<li><a href="/newsletter/" title="Luxagraf Email Updates">Email</a></li>
- <li><a href="https://twitter.com/luxagraf" rel="me" title="follow luxagraf on Twitter">Twitter</a></li>
- <li><a href="https://www.facebook.com/luxagraf" rel="me" title="luxagraf on Facebook">Facebook</a></li>
+ <li><a href="https://www.instagram.com/luxagraf" rel="me" title="luxagraf on Instagram">Instagram</a></li>
</ul>
</ul>
<div class="support">Support luxagraf: