diff options
-rw-r--r-- | app/sketches/admin.py | 8 | ||||
-rw-r--r-- | app/sketches/models.py | 5 | ||||
-rw-r--r-- | design/templates/archives/sketches.html | 66 |
3 files changed, 78 insertions, 1 deletions
diff --git a/app/sketches/admin.py b/app/sketches/admin.py index 9f3c087..41715aa 100644 --- a/app/sketches/admin.py +++ b/app/sketches/admin.py @@ -1,9 +1,10 @@ from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin from django.contrib.contenttypes.admin import GenericTabularInline + from .models import Sketch from utils.widgets import LGEntryForm, OLAdminBase - +from utils.util import get_latlon @admin.register(Sketch) class SketchAdmin(OLAdminBase): @@ -27,6 +28,11 @@ class SketchAdmin(OLAdminBase): } ), ) + lat, lon = get_latlon() + default_lon = lon + default_lat = lat + default_zoom = 10 + class Media: js = ('image-loader.js',) diff --git a/app/sketches/models.py b/app/sketches/models.py index 22522bd..c7d28a5 100644 --- a/app/sketches/models.py +++ b/app/sketches/models.py @@ -25,6 +25,11 @@ class Sketch(models.Model): ) status = models.IntegerField(choices=PUB_STATUS, default=1) + class Meta: + ordering = ('-pub_date',) + get_latest_by = 'pub_date' + verbose_name_plural = 'sketches' + def __str__(self): return self.title diff --git a/design/templates/archives/sketches.html b/design/templates/archives/sketches.html new file mode 100644 index 0000000..56d3714 --- /dev/null +++ b/design/templates/archives/sketches.html @@ -0,0 +1,66 @@ +{% 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%}class="notes" 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> → </li> + <li>Field Notes</li> + </ul> + <main role="main"> + <h1>Field Notes</h1> + <h4 class="subhead divide-after">Quick notes, sketches and images from the road (often literally)</h4> + {% 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"> + {{object.body_html|safe|smartypants}} + </div> + <span class="p-author h-card"> + <data class="p-name" value="Scott Gilbertson"></data> + <data class="u-url" value="https://luxagraf.net/"></data> + </span> + <footer> + {%comment%}<p class="note--date"> + <a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.pub_date|html5_datetime}}">{{object.pub_date|date:"F j, Y"}}</time></a> + </p>{%endcomment%}{% if object.location %} + <p class="p-location h-adr note--location bl" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo"> + <span class="p-locality">{{object.location.name|smartypants|safe}}</span>, + <span class="p-region">{{object.location.state.name}}</span>, + <span class="p-country-name">{{object.location.state.country.name}}</span> + <data class="p-latitude" value="{{object.latitude}}"></data> + <data class="p-longitude" value="{{object.longitude}}"></data> + </p>{% endif %} + + <p class="note--date"> + <a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.pub_date|html5_datetime}}">{{object.pub_date|date:"F j, Y"}}</time></a> + </p> + {% comment %} {% if object.twitter_id %} + <ul class="note--actions"> + <li><a rel="syndication" class="u-syndication" href="https://twitter.com/luxagraf/status/{{object.twitter_id}}">View on Twitter</a></li> + <li> + <indie-action do="reply" with="{{SITE_URL}}{{object.get_absolute_url}}"><a href="https://twitter.com/intent/tweet?in_reply_to={{object.twitter_id}}">Reply</a></indie-action> + </li> + <li> + <indie-action do="post" with="{{SITE_URL}}{{object.get_absolute_url}}"> + <a href="https://twitter.com/intent/retweet?tweet_id={{object.twitter_id}}">Retweet</a> + </indie-action> + </li> + <li> + <indie-action do="bookmark" with="{{SITE_URL}}{{object.get_absolute_url}}"> + <a href="https://twitter.com/intent/favorite?tweet_id={{object.twitter_id}}">Favourite</a> + </indie-action> + </li> + </ul>{% endif %}{% endcomment %} + </footer> + </article> +{% endfor %} + </main> +{% endblock %} + + + |