diff options
author | luxagraf <sng@luxagraf.net> | 2014-05-08 19:44:58 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2014-05-08 19:44:58 -0400 |
commit | 58e402a077c710c04934e3a7ddc25883427d1f64 (patch) | |
tree | 485506e3c1805a793f2d5920751f53c400b08aac | |
parent | 5f430f31474847ac50fa017dc1397c3bde2d140d (diff) |
added birding app, fixed a few python-related bugs throughout the code base.
35 files changed, 77 insertions, 50 deletions
diff --git a/app/blog/admin.py b/app/blog/admin.py index c0d72d9..d756b18 100644 --- a/app/blog/admin.py +++ b/app/blog/admin.py @@ -4,7 +4,7 @@ from blog.models import Entry, PostImage, EntryAside from blog.widgets import AdminImageWidget from django.contrib.gis.admin import OSMGeoAdmin from django.conf import settings -from models import * +from .models import * diff --git a/app/blog/widgets.py b/app/blog/widgets.py index e7d9da8..33b2d9a 100644 --- a/app/blog/widgets.py +++ b/app/blog/widgets.py @@ -7,7 +7,7 @@ import os def thumbnail(image_path): absolute_url = os.path.join(settings.IMAGES_URL, image_path[7:]) - print absolute_url + print(absolute_url) return u'<img style="max-width: 400px" src="%s" alt="%s" />' % (absolute_url, image_path) class AdminImageWidget(AdminFileWidget): diff --git a/app/guide/models.py b/app/guide/models.py index 5a2036d..90f63e1 100644 --- a/app/guide/models.py +++ b/app/guide/models.py @@ -7,7 +7,7 @@ from django.template.defaultfilters import truncatewords_html from PIL import Image -from utils import markdown2 as markdown +import markdown from taggit.managers import TaggableManager from locations.models import Location,Region,Country from blog.models import Entry diff --git a/app/locations/admin.py b/app/locations/admin.py index 0d1c57a..c61d9de 100644 --- a/app/locations/admin.py +++ b/app/locations/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin -from locations.models import Region,Country,Location,State,Route +from locations.models import Region,Country,Location,State,Route,BirdingLocation from django.contrib.gis.maps.google import GoogleMap from django.conf import settings @@ -293,3 +293,27 @@ class RouteAdmin(OSMGeoAdmin): # associating the Options with the actual model admin.site.register(Route,RouteAdmin) + + +class BirdingLocationAdmin(OSMGeoAdmin): + list_display = ('name','slug',) + prepopulated_fields = {'slug': ('name',)} + search_fields = ('name',) + ordering = ('name',) + save_as = True + search_fields = ['name',] + list_select_related = True + fieldsets = ( + ('Location', {'fields': ('name','point', 'slug','location'), 'classes': ('show','extrapretty')}), + ) + #options for OSM map Using custom ESRI topo map + default_lon = -10909310 + default_lat = 4650301 + default_zoom = 4 + units = True + scrollable = False + map_width = 700 + map_height = 425 + map_template = 'gis/admin/osm.html' + +admin.site.register(BirdingLocation,BirdingLocationAdmin) diff --git a/app/locations/models.py b/app/locations/models.py index 000105e..bbeb2e0 100755 --- a/app/locations/models.py +++ b/app/locations/models.py @@ -159,7 +159,6 @@ class Location(models.Model): def __unicode__(self): return self.name -""" class BirdingLocation(models.Model): location = models.ForeignKey(Location) name = models.CharField(max_length=50) @@ -174,7 +173,6 @@ class BirdingLocation(models.Model): def __unicode__(self): return self.name -""" class Route(models.Model): name = models.CharField(max_length=200) diff --git a/app/pages/models.py b/app/pages/models.py index 198e186..fcc0e5a 100644 --- a/app/pages/models.py +++ b/app/pages/models.py @@ -3,7 +3,7 @@ from django.db import models from django.conf import settings from django.contrib.sitemaps import Sitemap -from utils import markdown2 as markdown +import markdown def markdown_processor(md): return markdown.markdown(md, ['footnotes'],safe_mode = False) diff --git a/app/photos/models.py b/app/photos/models.py index e64e186..7daae94 100644 --- a/app/photos/models.py +++ b/app/photos/models.py @@ -1,10 +1,10 @@ import datetime -import Image +from PIL import Image import os.path from django.contrib.gis.db import models from django.contrib.sitemaps import Sitemap from django.contrib.syndication.views import Feed -from django.utils.encoding import force_unicode +from django.utils.encoding import force_text from django.conf import settings @@ -48,7 +48,7 @@ class Photo(models.Model): def admin_thumbnail(self): - return force_unicode('<a href="%s"><img src="%s"></a>' % \ + return force_text('<a href="%s"><img src="%s"></a>' % \ (self.get_absolute_url(), self.get_small_square_url())) admin_thumbnail.allow_tags = True admin_thumbnail.short_description = 'Thumbnail' diff --git a/app/projects/models/__init__.py b/app/projects/models/__init__.py index 19a4f56..ca95ec7 100644 --- a/app/projects/models/__init__.py +++ b/app/projects/models/__init__.py @@ -1,5 +1,5 @@ -from base import Project -from fiveby import FiveBy -from natparks import NationalParks -from code import Code, CodeBlogDemo, CodeBlogEntry -from gifs import AnimatedGif +from .base import Project +from .fiveby import FiveBy +from .natparks import NationalParks +from .code import Code, CodeBlogDemo, CodeBlogEntry +from .gifs import AnimatedGif diff --git a/app/projects/models/base.py b/app/projects/models/base.py index 23d2af4..26a0122 100644 --- a/app/projects/models/base.py +++ b/app/projects/models/base.py @@ -5,7 +5,7 @@ from django.contrib.sitemaps import Sitemap from django.template.defaultfilters import truncatewords_html from django.contrib.syndication.views import Feed -from utils import markdown2 as markdown +import markdown from photos.models import PhotoGallery diff --git a/app/projects/models/code.py b/app/projects/models/code.py index 19de428..495fc2f 100644 --- a/app/projects/models/code.py +++ b/app/projects/models/code.py @@ -1,7 +1,7 @@ import datetime from django.db import models -from utils import markdown2 as markdown +import markdown PUB_STATUS = ( (0, 'Draft'), (1, 'Published'), diff --git a/config/djadmin.sh b/config/djadmin.sh index a3e99f3..a6ae84c 100755 --- a/config/djadmin.sh +++ b/config/djadmin.sh @@ -3,7 +3,7 @@ DIR="$( cd "$( dirname $( dirname "${BASH_SOURCE[0]}" ) )" && pwd )" PYTHONPATH=$PYTHONPATH:$DIR PYTHONPATH=$PYTHONPATH:"${DIR}/app" PYTHONPATH=$PYTHONPATH:"${DIR}/app/lib" -PYTHONPATH=$PYTHONPATH:"${DIR}/venv/lib/python2.7/" +PYTHONPATH=$PYTHONPATH:"${DIR}/venv/lib/python3.4/" export PYTHONPATH export DJANGO_SETTINGS_MODULE=config.settings.settings ADMIN="${DIR}/venv/bin/django-admin.py" diff --git a/config/settings/settings.py b/config/settings/settings.py index a205776..82d31e6 100644 --- a/config/settings/settings.py +++ b/config/settings/settings.py @@ -155,12 +155,12 @@ INSTALLED_APPS = ( 'blog', 'photos', 'taggit', + 'typogrify', 'links', 'pagination', 'templatetags', 'projects', 'guide', 'pages', - 'books', - 'stuff', + 'birds', ) diff --git a/config/wsgi.py b/config/wsgi.py index ab5f23a..3decdc7 100644 --- a/config/wsgi.py +++ b/config/wsgi.py @@ -6,15 +6,14 @@ sys.stdout = sys.stderr SERVER_ROOT = abspath(dirname(dirname(__file__)))+'/' # Tell wsgi to add the Python site-packages to it's path. -site.addsitedir(SERVER_ROOT+'venv/lib/python2.7/site-packages') +site.addsitedir(SERVER_ROOT+'venv/lib/python3.4/site-packages') -from django.core.handlers.wsgi import WSGIHandler -os.environ['DJANGO_SETTINGS_MODULE'] = 'config.settings.settings' -application = WSGIHandler() +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.settings") sys.path = [SERVER_ROOT,] + sys.path +sys.path.insert(0, os.path.join(SERVER_ROOT, "app")) +sys.path.insert(0, os.path.join(SERVER_ROOT, "app/lib")) +sys.path.insert(0, os.path.join(SERVER_ROOT, "config")) -from django.conf import settings -sys.path.insert(0, os.path.join(settings.PROJ_ROOT, "app")) -sys.path.insert(0, os.path.join(settings.PROJ_ROOT, "app/lib")) -sys.path.insert(0, os.path.join(settings.PROJ_ROOT, "config")) +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() diff --git a/design/templates/archives/guide.html b/design/templates/archives/guide.html index 27ac756..e6e3f97 100644 --- a/design/templates/archives/guide.html +++ b/design/templates/archives/guide.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% load pagination_tags %} {% block pagetitle %}Luxagraf | {% if region %}Travel Guide {{region.name|title|smartypants|safe}}{%else%} Travel Guides, Tips, Tricks and Recommendations {%endif%} Page {{page}}{% endblock %} diff --git a/design/templates/archives/homepage.html b/design/templates/archives/homepage.html index 692b21c..789616c 100644 --- a/design/templates/archives/homepage.html +++ b/design/templates/archives/homepage.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {%block bodyid%}id="home"{%endblock%} {% block primary %}<section class="archive">{% for object in object_list %}{% if forloop.counter == 1 %} diff --git a/design/templates/archives/map.html b/design/templates/archives/map.html index 5b495af..550a898 100644 --- a/design/templates/archives/map.html +++ b/design/templates/archives/map.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% load truncateletters %} {% load slugify_under %} {% block pagetitle %}Luxagraf | Map and Trips{% endblock %} diff --git a/design/templates/archives/map_data.html b/design/templates/archives/map_data.html index aa1bbe7..d235c8e 100644 --- a/design/templates/archives/map_data.html +++ b/design/templates/archives/map_data.html @@ -1,4 +1,4 @@ -{% load typogrify %} +{% load typogrify_tags %} {% load truncateletters %} var map = L.map('map-inner-canvas') diff --git a/design/templates/archives/photos.html b/design/templates/archives/photos.html index bc06f5c..e8d5ea6 100644 --- a/design/templates/archives/photos.html +++ b/design/templates/archives/photos.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% load pagination_tags %} {% block pagetitle %}Luxagraf | {% if region %}Photo Galleries: Images from {{region.name|title|smartypants|safe}}{%else%}Photo Galleries: Images from Around the World {%endif%} Page {{page}}{% endblock %} diff --git a/design/templates/archives/projects.html b/design/templates/archives/projects.html index f266c08..6b865af 100644 --- a/design/templates/archives/projects.html +++ b/design/templates/archives/projects.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}Luxagraf | Projects {% endblock %} {% block metadescription %}Travel Themes and Experiments {% endblock %} diff --git a/design/templates/archives/writing.html b/design/templates/archives/writing.html index dc8ea66..4ed8f44 100644 --- a/design/templates/archives/writing.html +++ b/design/templates/archives/writing.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% 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%} Page {{page}}{% endblock %} diff --git a/design/templates/bin/recent_entries.html b/design/templates/bin/recent_entries.html index 9bf6b28..6d08971 100644 --- a/design/templates/bin/recent_entries.html +++ b/design/templates/bin/recent_entries.html @@ -1 +1 @@ -{% load typogrify %} +{% load typogrify_tags %} diff --git a/design/templates/details/5x5.html b/design/templates/details/5x5.html index a9bdd63..fc6b187 100644 --- a/design/templates/details/5x5.html +++ b/design/templates/details/5x5.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}Luxagraf | Projects | 5x5 - Interviews from the road {% endblock %} {% block metadescription %}{% endblock %} diff --git a/design/templates/details/about.html b/design/templates/details/about.html index 026d408..d39992b 100644 --- a/design/templates/details/about.html +++ b/design/templates/details/about.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}Luxagraf | About{% endblock %} {% block metadescription %}About: Luxagraf is written and published by Scott Gilbertson. Writing is done in BBEdit, published with GeoDjango. Photos taken with a Panasonic GF1.{% endblock %} {%block htmlclass%}class="single"{%endblock%} diff --git a/design/templates/details/babyvideos.html b/design/templates/details/babyvideos.html index 80b41ab..a91136c 100644 --- a/design/templates/details/babyvideos.html +++ b/design/templates/details/babyvideos.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}Luxagraf | {{object.title}}{% endblock %} {% block extrahead %} <style> diff --git a/design/templates/details/code.html b/design/templates/details/code.html index 1697844..8b72a18 100644 --- a/design/templates/details/code.html +++ b/design/templates/details/code.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}Luxagraf | Projects | Code and Other Experiments {% endblock %} {%block htmlclass%}class="single"{%endblock%} {% block metadescription %}Browser extentsions to block comments on onlineathens.com{% endblock %} diff --git a/design/templates/details/contact.html b/design/templates/details/contact.html index ec47c34..889b9bb 100644 --- a/design/templates/details/contact.html +++ b/design/templates/details/contact.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {%block htmlclass%}class="single"{%endblock%} {% block pagetitle %}Luxagraf: Email{% endblock %} {% block metadescription %}{% endblock %} diff --git a/design/templates/details/entry.html b/design/templates/details/entry.html index 5784831..19039d9 100644 --- a/design/templates/details/entry.html +++ b/design/templates/details/entry.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}{{object.title|title|smartypants|safe}} - Luxagraf, Writing{%comment%}{% if object.country_name == "United States" %}{{object.location_name|smartypants|safe}}, {{object.state_name}}{%else%}{{object.location_name|smartypants|safe}}, {{object.country_name}}{%endif%}{%endcomment%}{% endblock %} @@ -28,7 +28,7 @@ class="{%if t == 0 or t == 2 %}single{%endif%}{%if t == 1 or t == 3 %}double{%en </aside> </header> <div class="post-body{% with object.template_name as t %}{%if t == 0 or t == 2 %}-single{%endif%}{%if t == 1 or t == 3 %}-double{%endif%}{%endwith%}"> - {{object.body_html|smartypants|widont|safe}} + {{object.body_html|safe|smartypants|widont}} </div>{%if object.template_name == 1 %} <div class="clearfix"></div>{%endif%}{%if object.template_name == 3 %}<div class="clearfix"></div>{%endif%} {%comment%} diff --git a/design/templates/details/guide.html b/design/templates/details/guide.html index c5dc80f..a749083 100644 --- a/design/templates/details/guide.html +++ b/design/templates/details/guide.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}{{object.title|title|smartypants|safe}} | Luxagraf, a travelogue | {% if object.country_name == "United States" %}{{object.location_name|smartypants|safe}}, {{object.state_name}}{%else%}{{object.location_name|smartypants|safe}}, {{object.country_name}}{%endif%}){% endblock %} diff --git a/design/templates/details/national-parks.html b/design/templates/details/national-parks.html index 8c90f84..e17bd72 100644 --- a/design/templates/details/national-parks.html +++ b/design/templates/details/national-parks.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}Luxagraf | Projects | National Parks {% endblock %} {% block metadescription %}{% endblock %} diff --git a/design/templates/details/page.html b/design/templates/details/page.html index 8a79e2c..74c75bd 100644 --- a/design/templates/details/page.html +++ b/design/templates/details/page.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}Luxagraf | {{object.title}}{% endblock %} {% block metadescription %}{{object.metadescription}}{% endblock %} {%block htmlclass%}class="single"{%endblock%} diff --git a/design/templates/details/photo.html b/design/templates/details/photo.html index 200995f..e477c73 100644 --- a/design/templates/details/photo.html +++ b/design/templates/details/photo.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% block pagetitle %}Luxagraf | {{object.title|title|smartypants|safe}}{% endblock %} {% block metadescription %}Luxagraf: Photo, {{object.title}}, Photographer: Scott Gilbertson, Published: {{ object.pub_date|date:"N j, Y" }} {{ object.pub_date|date:"h:i a" }}Camera:{%if object.exif_make%}{%if object.exif_make != 'Canon'%}{{ object.exif_make }}{%endif%} {{ object.exif_model }}{% else %}Canon Powershot S45{%endif%}, Aperture: {%if object.exif_aperture%}{{ object.exif_aperture }}{%else%}Not Recorded{%endif%}, Shutter Speed: {%if object.exif_shutter%}{{ object.exif_shutter }} sec{%else%}Not Recorded{%endif%}, Film Speed: {%if object.exif_iso%}{{ object.exif_iso }} ISO{%else%}Not Recorded{%endif%}.{% endblock %} {% block date %}{{object.pub_date|date:"F j, Y"}}<span class="small byline">{% if object.location.state.country.name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state.name}}{%else%}{{object.location.name|smartypants|safe}}, {{object.location.state.country.name}}{%endif%}</span>{% endblock %} @@ -82,4 +82,4 @@ </dl> </div> </div> -{% endblock %}
\ No newline at end of file +{% endblock %} diff --git a/design/templates/details/photo_galleries.html b/design/templates/details/photo_galleries.html index cdaf2c2..d992af4 100644 --- a/design/templates/details/photo_galleries.html +++ b/design/templates/details/photo_galleries.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load typogrify %} +{% load typogrify_tags %} {% load number_to_word %} {% block pagetitle %}{{object.set_title}} - Luxagraf, Photos{% endblock %} diff --git a/design/templates/gis/admin/google.js b/design/templates/gis/admin/google.js index a7d1467..3ecb766 100644 --- a/design/templates/gis/admin/google.js +++ b/design/templates/gis/admin/google.js @@ -1,2 +1,2 @@ {% extends "gis/admin/openlayers.js" %}
-{% block base_layer %}new OpenLayers.Layer.Google("Google Base Layer", {'type': G_NORMAL_MAP, 'sphericalMercator' : true});{% endblock %}
\ No newline at end of file +{% block base_layer %}new OpenLayers.Layer.Google("Google Base Layer", {'type': G_NORMAL_MAP, 'sphericalMercator' : true});{% endblock %}
diff --git a/design/templates/gis/admin/osm.html b/design/templates/gis/admin/osm.html new file mode 100644 index 0000000..e27526a --- /dev/null +++ b/design/templates/gis/admin/osm.html @@ -0,0 +1,2 @@ +{% extends "gis/admin/openlayers.html" %} +{% block openlayers %}{% include "gis/admin/osm_extra.js" %}{% endblock %} diff --git a/design/templates/gis/admin/osm_extra.js b/design/templates/gis/admin/osm_extra.js new file mode 100644 index 0000000..774be47 --- /dev/null +++ b/design/templates/gis/admin/osm_extra.js @@ -0,0 +1,4 @@ +{% extends "gis/admin/openlayers.js" %} +{% block base_layer %} +new OpenLayers.Layer.XYZ( "ESRI", "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/${z}/${y}/${x}", {sphericalMercator: true} ); +{% endblock %} |