diff --git a/databaseReset.py b/databaseReset.py index 5503104..77a7b8a 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -47,6 +47,7 @@ def import_QMs(): def import_surveys(): import parsers.surveys + parsers.surveys.parseSurveys(logfile=settings.LOGFILE) def reset(): reload_db() diff --git a/expo/imagekit_specs.py b/expo/imagekit_specs.py index 243cb9f..fd2e0a1 100644 --- a/expo/imagekit_specs.py +++ b/expo/imagekit_specs.py @@ -3,20 +3,19 @@ from imagekit import processors class ResizeThumb(processors.Resize): width = 100 - height = 75 - crop = True + crop = False class ResizeDisplay(processors.Resize): width = 600 -class EnhanceThumb(processors.Adjustment): - contrast = 1.2 - sharpness = 1.1 +#class EnhanceThumb(processors.Adjustment): + #contrast = 1.2 + #sharpness = 2 class Thumbnail(ImageSpec): access_as = 'thumbnail_image' pre_cache = True - processors = [ResizeThumb, EnhanceThumb] + processors = [ResizeThumb] class Display(ImageSpec): increment_count = True diff --git a/expo/models.py b/expo/models.py index 4c8332b..74a26d4 100644 --- a/expo/models.py +++ b/expo/models.py @@ -17,8 +17,11 @@ from models_survex import * class TroggleModel(models.Model): new_since_parsing = models.BooleanField(default=False, editable=False) + def object_name(self): + return self._meta.object_name + def get_admin_url(self): - return settings.URL_ROOT + "/admin/expo/" + self._meta.object_name.lower() + "/" + str(self.pk) + return settings.URL_ROOT + "/admin/expo/" + self.object_name.lower() + "/" + str(self.pk) class Meta: abstract = True @@ -26,8 +29,11 @@ class TroggleModel(models.Model): class TroggleImageModel(ImageModel): new_since_parsing = models.BooleanField(default=False, editable=False) + def object_name(self): + return self._meta.object_name + def get_admin_url(self): - return settings.URL_ROOT + "/admin/expo/" + self._meta.object_name.lower() + "/" + str(self.pk) + return settings.URL_ROOT + "/admin/expo/" + self.object_name.lower() + "/" + str(self.pk) class Meta: abstract = True @@ -42,7 +48,7 @@ class Expedition(TroggleModel): return self.year class Meta: - ordering = ('year',) + ordering = ('-year',) get_latest_by = 'date_from' def get_absolute_url(self): diff --git a/settings.py b/settings.py index 6b878ee..e99d199 100644 --- a/settings.py +++ b/settings.py @@ -1,3 +1,4 @@ +from localsettings import * import os import urlparse # Django settings for troggle project. @@ -35,11 +36,10 @@ USE_I18N = True ADMIN_MEDIA_PREFIX = '/troggle/media-admin/' PHOTOS_ROOT = os.path.join(EXPOWEB, 'photos') -if URL_ROOT: - MEDIA_URL = urlparse.urljoin(URL_ROOT , '/site_media/') - SURVEYS_URL = urlparse.urljoin(URL_ROOT , '/survey_scans/') - PHOTOS_URL = urlparse.urljoin(URL_ROOT , '/photos/') - SVX_URL = urlparse.urljoin(URL_ROOT , '/survex/') +MEDIA_URL = urlparse.urljoin(URL_ROOT , '/site_media/') +SURVEYS_URL = urlparse.urljoin(URL_ROOT , '/survey_scans/') +PHOTOS_URL = urlparse.urljoin(URL_ROOT , '/photos/') +SVX_URL = urlparse.urljoin(URL_ROOT , '/survex/') APPEND_SLASH = False SMART_APPEND_SLASH = True @@ -86,6 +86,4 @@ INSTALLED_APPS = ( 'troggle.profiles', 'troggle.expo', 'troggle.imagekit', -) - -from localsettings import * \ No newline at end of file +) \ No newline at end of file diff --git a/templates/object_list.html b/templates/object_list.html new file mode 100644 index 0000000..4021ad2 --- /dev/null +++ b/templates/object_list.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% load link %} +{% block title %}Troggle: all {{object_list.1.meta.object_name}} objects{%endblock%} + +{% block contentheader %} +

All {{object_list.0.object_name}} objects

+{% endblock contentheader %} + +{% block content %} + +{% endblock content %} \ No newline at end of file diff --git a/urls.py b/urls.py index f5decdb..fdead4d 100644 --- a/urls.py +++ b/urls.py @@ -7,6 +7,7 @@ from expo.views_survex import * from expo.models import * from django.views.generic.create_update import create_object from django.contrib import admin +from django.views.generic.list_detail import object_list admin.autodiscover() urlpatterns = patterns('', @@ -14,8 +15,8 @@ urlpatterns = patterns('', url(r'^$', views_other.frontpage, name="frontpage"), url(r'^todo/$', views_other.todo, name="todo"), - url(r'^caveindex/?$', views_caves.caveindex, name="caveindex"), - url(r'^personindex$', views_logbooks.personindex, name="personindex"), + url(r'^caves/?$', views_caves.caveindex, name="caveindex"), + url(r'^people/?$', views_logbooks.personindex, name="personindex"), #(r'^person/(?P\d*)/?$', views_logbooks.person), @@ -23,6 +24,7 @@ urlpatterns = patterns('', #url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"), url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"), + url(r'^expeditions/?$', object_list, {'queryset':Expedition.objects.all(),'template_name':'expeditions.html'},name="expeditionlist"), url(r'^personexpedition/(?P[A-Z]*[a-z]*)[^a-zA-Z]*(?P[A-Z]*[a-z]*)/(?P\d+)/?$', views_logbooks.personexpedition, name="personexpedition"), url(r'^logbookentry/(?P.*)/(?P.*)/?$', views_logbooks.logbookentry,name="logbookentry"),