]> git.parisson.com Git - telemeta.git/commitdiff
* fix some wrong user properties
authoryomguy <yomguy@parisson.com>
Wed, 21 Mar 2012 15:21:08 +0000 (16:21 +0100)
committeryomguy <yomguy@parisson.com>
Wed, 21 Mar 2012 15:21:08 +0000 (16:21 +0100)
* 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

example/sandbox_sqlite/settings.py
setup.py
telemeta/templates/telemeta/inc/resource_related.html
telemeta/templates/telemeta/profile_detail.html
telemeta/urls.py

index f162486934b6275b9ff8afd4195fa885b17e1c62..e0b13d4f038d84426577447406e4554cd025cd4e 100644 (file)
@@ -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
index ea38a078b857fe737072d6147b0591522f533687..813a3bf0d365c8cd8491fa8a4b119241e4e10133 100644 (file)
--- 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',
index 442c7bfc129080a61bf2808ef767d513d0371f17..137d08e5f722e2f2d909eb6c9b07bbe5e7be74ba 100644 (file)
@@ -1,5 +1,6 @@
 {% load i18n %}
 {% load telemeta_utils %}
+{% load thumbnail %}
 
         <div>
             <h4><a href="#">{% trans "Related media" %}</a></h4>
 
                             <td style="padding-bottom: 1em;">
                                 {% if media.is_image %}
-                                  {% if media.url %}
-                                   <a href="{{ media.url }}">
-                                   <img src="{{ media.url }}" style="max-width: 420px; max-height: 200px;" /></a>
+                                  {% if media.file %}
+                                  <a href="{% url telemeta-resource-related type resource.code media.id %}">
+                                   {% thumbnail media.file "420" as im %}
+                                    <img src="{{ im.url }}" style="max-width: 420px; max-height: 200px;" />
+                                   {% endthumbnail %}
+                                   </a>
                                   {% else %}
-                                   <a href="{% url telemeta-resource-related type resource.code media.id %}">
-                                   <img src="{% url telemeta-resource-related type resource.code media.id %}" style="max-width: 420px; max-height: 200px;" /></a>
-                                   {% endif %}
+                                  <a href="{{ media.url }}">
+                                  {% thumbnail media.url "420" as im %}
+                                   <img src="{{ im.url }}" style="max-width: 420px; max-height: 200px;" />
+                                  {% endthumbnail %}
+                                  </a>
+                                 {% endif %}
                                 {% else %}
                                 {% if media.url %}
                                  {% if "youtu" in media.url %}
index 3e8128c495c282b03cb126644513017a76bdc075..4bfa103c8518f829a75c18bc5a1f5faef29329ae 100644 (file)
@@ -41,6 +41,7 @@
       <dt>{% trans "Email" %}</dt><dd>{{ usr.email }}</dd>
       
       <dt>{% trans "Institution" %}</dt><dd>{% if profile %}{{ profile.institution }}{% endif %}</dd>
+      <dt>{% trans "Department" %}</dt><dd>{% if profile %}{{ profile.department }}{% endif %}</dd>
       <dt>{% trans "Function" %}</dt><dd>{% if profile %}{{ profile.function }}{% endif %}</dd>
       <dt>{% trans "Attachment" %}</dt><dd>{% if profile %}{{ profile.attachment }}{% endif %}</dd>
       <dt>{% trans "Address" %}</dt><dd>{% if profile %}{{ profile.address }}{% endif %}</dd>
index f89938b39f164d57fc7aa13006464b3c8ad83b51..e4961c1d575629bbda8549d942c62b3c0dc90426 100644 (file)
@@ -35,6 +35,7 @@
 #          Guillaume Pellerin <yomguy@parisson.com>
 
 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<path>.*)$', 'django.views.static.serve', {
+            'document_root': settings.TELEMETA_CACHE_DIR,}),
 )