summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-01-03 14:30:59 -0600
committerluxagraf <sng@luxagraf.net>2019-01-03 14:30:59 -0600
commit7946407380077ca56bbeccc20405ac0fa43595bb (patch)
treee3fa64674ed7d591ff464b15f608beeebd36aeaa
parentd635df078e61448ed572b7d10558a96e001937fe (diff)
added a daily photo section
-rw-r--r--app/photos/admin.py2
-rw-r--r--app/photos/urls.py47
-rw-r--r--app/photos/views.py8
-rw-r--r--design/templates/archives/photo_daily_list.html22
-rw-r--r--design/templates/archives/sketches.html8
5 files changed, 43 insertions, 44 deletions
diff --git a/app/photos/admin.py b/app/photos/admin.py
index d740df6..8e605ee 100644
--- a/app/photos/admin.py
+++ b/app/photos/admin.py
@@ -43,7 +43,7 @@ class LuxImageAdmin(OSMGeoAdmin):
fieldsets = (
(None, {
- 'fields': (('image'), 'pub_date', 'sizes', 'alt', 'caption', 'point', ('is_public'), ('photo_credit_source', 'photo_credit_url'))
+ 'fields': ('title', ('image'), 'pub_date', 'sizes', 'alt', 'caption', 'point', ('is_public'), ('photo_credit_source', 'photo_credit_url'))
}),
('Exif Data', {
'classes': ('collapse',),
diff --git a/app/photos/urls.py b/app/photos/urls.py
index 8c51d60..cbac965 100644
--- a/app/photos/urls.py
+++ b/app/photos/urls.py
@@ -7,7 +7,12 @@ app_name = "photos"
urlpatterns = [
path(
- r'data/(<str:slug>/$',
+ r'daily/<int:page>',
+ views.DailyPhotoList.as_view(),
+ name="daily_photo_list"
+ ),
+ path(
+ r'data/(<str:slug>/',
views.photo_json
),
re_path(
@@ -20,44 +25,4 @@ urlpatterns = [
views.thumb_preview_json,
name="admin_thumb_preview"
),
- re_path(
- r'galleries/private/(?P<slug>[-\w]+)$',
- views.PrivateGallery.as_view(),
- name="private"
- ),
- re_path(
- r'galleries/private/(?P<page>\d+)/$',
- views.PrivateGalleryList.as_view(),
- name="private_list"
- ),
- re_path(
- r'galleries/private/$',
- RedirectView.as_view(url="/photos/galleries/private/1/", permanent=False)
- ),
- re_path(
- r'galleries/(?P<slug>[-\w]+)$',
- views.Gallery.as_view(),
- name="private"
- ),
- re_path(
- r'galleries/(?P<page>\d+)/$',
- views.GalleryList.as_view(),
- name="private_list"
- ),
- re_path(
- r'galleries/$',
- RedirectView.as_view(url="/photos/galleries/1/", permanent=False)
- ),
- re_path(
- r'(?P<page>\d+)/$',
- views.gallery_list,
- ),
- re_path(
- r'(?P<slug>[-\w]+)/$',
- RedirectView.as_view(url="/photos/%(slug)s/1/", permanent=False)
- ),
- re_path(
- r'',
- RedirectView.as_view(url="/photos/1/", permanent=False)
- ),
]
diff --git a/app/photos/views.py b/app/photos/views.py
index ec4ba61..915b022 100644
--- a/app/photos/views.py
+++ b/app/photos/views.py
@@ -30,6 +30,7 @@ class PrivateGalleryList(PaginatedListView):
context['is_private'] = True
return context
+
class Gallery(DetailView):
model = LuxGallery
slug_field = "slug"
@@ -62,6 +63,13 @@ class OldGalleryList(PaginatedListView):
return context
+class DailyPhotoList(PaginatedListView):
+ template_name = 'archives/photo_daily_list.html'
+
+ def get_queryset(self):
+ return LuxImage.objects.filter(is_public=True, title__startswith="daily_")
+
+
def gallery_list(request, page):
request.page_url = '/photos/%d/'
request.page = int(page)
diff --git a/design/templates/archives/photo_daily_list.html b/design/templates/archives/photo_daily_list.html
new file mode 100644
index 0000000..59612ac
--- /dev/null
+++ b/design/templates/archives/photo_daily_list.html
@@ -0,0 +1,22 @@
+{% extends 'base.html' %}
+{%block htmlclass%}class="detail single"{% endblock %}
+{% load typogrify_tags %}
+{% load html5_datetime %}
+{% load pagination_tags %}
+{% block pagetitle %} Field Notes | luxagraf {% endblock %}
+{% block metadescription %} Recent Images {% endblock %}
+{%block bodyid%}class="photos" id="notes-archive"{%endblock%}
+
+{% block primary %}
+ <ul class="bl" id="breadcrumbs" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
+ <li><a href="/" title="luxagraf homepage" itemprop="url"><span itemprop="title">Home</span></a> &rarr; </li>
+ <li>Photos</li>
+ </ul>
+ <main role="main">
+ {% autopaginate object_list 8 %}{% for object in object_list %}
+ <article class="h-entry hentry " itemscope="" itemtype="http://schema.org/Article">
+ {% include 'lib/img_picwide.html' with image=object caption=False exif=False is_cluster=False cluster_class='' extra='' %}
+ </article>
+ {% endfor %}
+ </main>
+{% endblock%}
diff --git a/design/templates/archives/sketches.html b/design/templates/archives/sketches.html
index 1021c25..cf53ac1 100644
--- a/design/templates/archives/sketches.html
+++ b/design/templates/archives/sketches.html
@@ -14,7 +14,7 @@
<main role="main">
<h1>Field Notes</h1>
<h4 class="subhead divide-after">Quick notes, sketches and images from the road (often literally)</h4>
- {% autopaginate object_list 12 %}{% for object in object_list %}
+ {% autopaginate object_list 8 %}{% for object in object_list %}
<article class="h-entry post--article">
{% if object.title %}<h1 class="p-name note--title"><a href="{{object.get_absolute_url}}" class="permalink">{{object.title|safe|amp|smartypants}}</a></h1>{%endif%}
<div class="e-content">
@@ -59,7 +59,11 @@
</footer>
</article>
{% endfor %}
- </main>
+ </main>
+
+ <nav class="pagination">
+ {% paginate %}
+ </nav>
{% endblock %}