forked from expo/troggle
[svn] Add: new generic object list template object_list.html, and convenience filter named "link" for making links from objects, and make expeditions list page using those two. Also, fixed survey parsing in databaseReset.py
This commit is contained in:
parent
8538ef27a1
commit
5f93301493
@ -47,6 +47,7 @@ def import_QMs():
|
|||||||
|
|
||||||
def import_surveys():
|
def import_surveys():
|
||||||
import parsers.surveys
|
import parsers.surveys
|
||||||
|
parsers.surveys.parseSurveys(logfile=settings.LOGFILE)
|
||||||
|
|
||||||
def reset():
|
def reset():
|
||||||
reload_db()
|
reload_db()
|
||||||
|
@ -3,20 +3,19 @@ from imagekit import processors
|
|||||||
|
|
||||||
class ResizeThumb(processors.Resize):
|
class ResizeThumb(processors.Resize):
|
||||||
width = 100
|
width = 100
|
||||||
height = 75
|
crop = False
|
||||||
crop = True
|
|
||||||
|
|
||||||
class ResizeDisplay(processors.Resize):
|
class ResizeDisplay(processors.Resize):
|
||||||
width = 600
|
width = 600
|
||||||
|
|
||||||
class EnhanceThumb(processors.Adjustment):
|
#class EnhanceThumb(processors.Adjustment):
|
||||||
contrast = 1.2
|
#contrast = 1.2
|
||||||
sharpness = 1.1
|
#sharpness = 2
|
||||||
|
|
||||||
class Thumbnail(ImageSpec):
|
class Thumbnail(ImageSpec):
|
||||||
access_as = 'thumbnail_image'
|
access_as = 'thumbnail_image'
|
||||||
pre_cache = True
|
pre_cache = True
|
||||||
processors = [ResizeThumb, EnhanceThumb]
|
processors = [ResizeThumb]
|
||||||
|
|
||||||
class Display(ImageSpec):
|
class Display(ImageSpec):
|
||||||
increment_count = True
|
increment_count = True
|
||||||
|
@ -17,8 +17,11 @@ from models_survex import *
|
|||||||
class TroggleModel(models.Model):
|
class TroggleModel(models.Model):
|
||||||
new_since_parsing = models.BooleanField(default=False, editable=False)
|
new_since_parsing = models.BooleanField(default=False, editable=False)
|
||||||
|
|
||||||
|
def object_name(self):
|
||||||
|
return self._meta.object_name
|
||||||
|
|
||||||
def get_admin_url(self):
|
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:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
@ -26,8 +29,11 @@ class TroggleModel(models.Model):
|
|||||||
class TroggleImageModel(ImageModel):
|
class TroggleImageModel(ImageModel):
|
||||||
new_since_parsing = models.BooleanField(default=False, editable=False)
|
new_since_parsing = models.BooleanField(default=False, editable=False)
|
||||||
|
|
||||||
|
def object_name(self):
|
||||||
|
return self._meta.object_name
|
||||||
|
|
||||||
def get_admin_url(self):
|
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:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
@ -42,7 +48,7 @@ class Expedition(TroggleModel):
|
|||||||
return self.year
|
return self.year
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('year',)
|
ordering = ('-year',)
|
||||||
get_latest_by = 'date_from'
|
get_latest_by = 'date_from'
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
|
14
settings.py
14
settings.py
@ -1,3 +1,4 @@
|
|||||||
|
from localsettings import *
|
||||||
import os
|
import os
|
||||||
import urlparse
|
import urlparse
|
||||||
# Django settings for troggle project.
|
# Django settings for troggle project.
|
||||||
@ -35,11 +36,10 @@ USE_I18N = True
|
|||||||
ADMIN_MEDIA_PREFIX = '/troggle/media-admin/'
|
ADMIN_MEDIA_PREFIX = '/troggle/media-admin/'
|
||||||
PHOTOS_ROOT = os.path.join(EXPOWEB, 'photos')
|
PHOTOS_ROOT = os.path.join(EXPOWEB, 'photos')
|
||||||
|
|
||||||
if URL_ROOT:
|
MEDIA_URL = urlparse.urljoin(URL_ROOT , '/site_media/')
|
||||||
MEDIA_URL = urlparse.urljoin(URL_ROOT , '/site_media/')
|
SURVEYS_URL = urlparse.urljoin(URL_ROOT , '/survey_scans/')
|
||||||
SURVEYS_URL = urlparse.urljoin(URL_ROOT , '/survey_scans/')
|
PHOTOS_URL = urlparse.urljoin(URL_ROOT , '/photos/')
|
||||||
PHOTOS_URL = urlparse.urljoin(URL_ROOT , '/photos/')
|
SVX_URL = urlparse.urljoin(URL_ROOT , '/survex/')
|
||||||
SVX_URL = urlparse.urljoin(URL_ROOT , '/survex/')
|
|
||||||
|
|
||||||
APPEND_SLASH = False
|
APPEND_SLASH = False
|
||||||
SMART_APPEND_SLASH = True
|
SMART_APPEND_SLASH = True
|
||||||
@ -86,6 +86,4 @@ INSTALLED_APPS = (
|
|||||||
'troggle.profiles',
|
'troggle.profiles',
|
||||||
'troggle.expo',
|
'troggle.expo',
|
||||||
'troggle.imagekit',
|
'troggle.imagekit',
|
||||||
)
|
)
|
||||||
|
|
||||||
from localsettings import *
|
|
15
templates/object_list.html
Normal file
15
templates/object_list.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load link %}
|
||||||
|
{% block title %}Troggle: all {{object_list.1.meta.object_name}} objects{%endblock%}
|
||||||
|
|
||||||
|
{% block contentheader %}
|
||||||
|
<h1>All {{object_list.0.object_name}} objects</h1>
|
||||||
|
{% endblock contentheader %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<ul>
|
||||||
|
{% for object in object_list %}
|
||||||
|
| {{ object|link }}
|
||||||
|
{% endfor %} |
|
||||||
|
</ul>
|
||||||
|
{% endblock content %}
|
6
urls.py
6
urls.py
@ -7,6 +7,7 @@ from expo.views_survex import *
|
|||||||
from expo.models import *
|
from expo.models import *
|
||||||
from django.views.generic.create_update import create_object
|
from django.views.generic.create_update import create_object
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.views.generic.list_detail import object_list
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
@ -14,8 +15,8 @@ urlpatterns = patterns('',
|
|||||||
url(r'^$', views_other.frontpage, name="frontpage"),
|
url(r'^$', views_other.frontpage, name="frontpage"),
|
||||||
url(r'^todo/$', views_other.todo, name="todo"),
|
url(r'^todo/$', views_other.todo, name="todo"),
|
||||||
|
|
||||||
url(r'^caveindex/?$', views_caves.caveindex, name="caveindex"),
|
url(r'^caves/?$', views_caves.caveindex, name="caveindex"),
|
||||||
url(r'^personindex$', views_logbooks.personindex, name="personindex"),
|
url(r'^people/?$', views_logbooks.personindex, name="personindex"),
|
||||||
|
|
||||||
|
|
||||||
#(r'^person/(?P<person_id>\d*)/?$', views_logbooks.person),
|
#(r'^person/(?P<person_id>\d*)/?$', views_logbooks.person),
|
||||||
@ -23,6 +24,7 @@ urlpatterns = patterns('',
|
|||||||
#url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"),
|
#url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"),
|
||||||
|
|
||||||
url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"),
|
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<first_name>[A-Z]*[a-z]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-z]*)/(?P<year>\d+)/?$', views_logbooks.personexpedition, name="personexpedition"),
|
url(r'^personexpedition/(?P<first_name>[A-Z]*[a-z]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-z]*)/(?P<year>\d+)/?$', views_logbooks.personexpedition, name="personexpedition"),
|
||||||
url(r'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', views_logbooks.logbookentry,name="logbookentry"),
|
url(r'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', views_logbooks.logbookentry,name="logbookentry"),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user