From: yomguy Date: Wed, 21 Mar 2012 15:21:08 +0000 (+0100) Subject: * fix some wrong user properties X-Git-Tag: 1.4.3~2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b6c6871c74d00f21f77c4dc5c370db6b3d367e2f;p=telemeta.git * fix some wrong user properties * NEW DEP: add solr-thumbnail for resource related media * add static media handling for solr and various cache * SECURITY: you need to move your TELEMETA_EXPORT_CACHE_DIR from TELEMETA_CACHE_DIR cache. See example/sandbox_sqlite/settings.py --- diff --git a/example/sandbox_sqlite/settings.py b/example/sandbox_sqlite/settings.py index f1624869..e0b13d4f 100644 --- a/example/sandbox_sqlite/settings.py +++ b/example/sandbox_sqlite/settings.py @@ -105,6 +105,7 @@ INSTALLED_APPS = ( 'telemeta', 'jsonrpc', 'south', + 'sorl.thumbnail', ) TEMPLATE_CONTEXT_PROCESSORS = ( @@ -117,7 +118,7 @@ TELEMETA_SUBJECTS = ('test', 'telemeta', 'sandbox') TELEMETA_DESCRIPTION = "Telemeta TEST sandbox" TELEMETA_GMAP_KEY = 'ABQIAAAArg7eSfnfTkBRma8glnGrlxRVbMrhnNNvToCbZQtWdaMbZTA_3RRGObu5PDoiBImgalVnnLU2yN4RMA' TELEMETA_CACHE_DIR = MEDIA_ROOT + 'cache' -TELEMETA_EXPORT_CACHE_DIR = TELEMETA_CACHE_DIR + "/export" +TELEMETA_EXPORT_CACHE_DIR = MEDIA_ROOT + 'export' TELEMETA_DATA_CACHE_DIR = TELEMETA_CACHE_DIR + "/data" TELEMETA_DOWNLOAD_ENABLED = True diff --git a/setup.py b/setup.py index ea38a078..813a3bf0 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ setup( 'django-pagination', 'django-postman', 'django-socialregistration', + 'sorl-thumbnail', ], platforms=['OS Independent'], license='CeCILL v2', diff --git a/telemeta/templates/telemeta/inc/resource_related.html b/telemeta/templates/telemeta/inc/resource_related.html index 442c7bfc..137d08e5 100644 --- a/telemeta/templates/telemeta/inc/resource_related.html +++ b/telemeta/templates/telemeta/inc/resource_related.html @@ -1,5 +1,6 @@ {% load i18n %} {% load telemeta_utils %} +{% load thumbnail %}

{% trans "Related media" %}

@@ -57,13 +58,19 @@ {% if media.is_image %} - {% if media.url %} - - + {% if media.file %} + + {% thumbnail media.file "420" as im %} + + {% endthumbnail %} + {% else %} - - - {% endif %} + + {% thumbnail media.url "420" as im %} + + {% endthumbnail %} + + {% endif %} {% else %} {% if media.url %} {% if "youtu" in media.url %} diff --git a/telemeta/templates/telemeta/profile_detail.html b/telemeta/templates/telemeta/profile_detail.html index 3e8128c4..4bfa103c 100644 --- a/telemeta/templates/telemeta/profile_detail.html +++ b/telemeta/templates/telemeta/profile_detail.html @@ -41,6 +41,7 @@
{% trans "Email" %}
{{ usr.email }}
{% trans "Institution" %}
{% if profile %}{{ profile.institution }}{% endif %}
+
{% trans "Department" %}
{% if profile %}{{ profile.department }}{% endif %}
{% trans "Function" %}
{% if profile %}{{ profile.function }}{% endif %}
{% trans "Attachment" %}
{% if profile %}{{ profile.attachment }}{% endif %}
{% trans "Address" %}
{% if profile %}{{ profile.address }}{% endif %}
diff --git a/telemeta/urls.py b/telemeta/urls.py index f89938b3..e4961c1d 100644 --- a/telemeta/urls.py +++ b/telemeta/urls.py @@ -35,6 +35,7 @@ # Guillaume Pellerin from django.conf.urls.defaults import * +from django.conf import settings from django.views.generic.simple import redirect_to from telemeta.models import MediaItem, MediaCollection, MediaItemMarker, MediaCorpus, MediaFonds from telemeta.views.base import GeneralView, AdminView, CollectionView, ItemView, \ @@ -329,6 +330,10 @@ urlpatterns = patterns('', # RSS feeds url(r'^rss/$', LastestRevisionsFeed(), name="telemeta-rss"), + # Static media + # FIXME:need to move export dir from the cache + url(r'^media/cache/(?P.*)$', 'django.views.static.serve', { + 'document_root': settings.TELEMETA_CACHE_DIR,}), )