put external stream in settings
authorymh <ymh.work@gmail.com>
Fri, 10 Feb 2012 01:05:32 +0100
changeset 552 6fbf608bd2a7
parent 551 c447d863b6ad
child 553 b5848487839b
put external stream in settings
src/ldt/ldt/ldt_utils/views/front.py
src/ldt/ldt/settings.py
web/ldtplatform/settings.py
--- a/src/ldt/ldt/ldt_utils/views/front.py	Thu Feb 09 22:17:34 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py	Fri Feb 10 01:05:32 2012 +0100
@@ -12,9 +12,9 @@
 
 def front_home(request):
     # Get the 3 last annotated contents
-    last_contents = Content.objects.order_by('-last_annotated').exclude(nb_annotation=0)[:3]
+    last_contents = Content.objects.order_by('-stat_annotation__last_annotated').exclude(stat_annotation__nb_annotation=0)[:3]
     # Get the most annotated contents
-    most_contents = Content.objects.order_by('-nb_annotation')[:8]
+    most_contents = Content.objects.order_by('-stat_annotation__nb_annotations')[:8]
     # Get the active groups
     active_groups = Group.objects.exclude(name=settings.PUBLIC_GROUP_NAME)[:5]
     # Get the main tag list
@@ -73,8 +73,11 @@
     content = Content.objects.get(iri_id=content_iri_id)
     # Get the content src to see if it is a youtube/dailymotion video
     external_url = None
-    if content.src is not None and (("youtube.com" in content.src) or ("dailymotion.com" in content.src)):
-        external_url = content.src
+    if content.src is not None:
+        for external_src in settings.EXTERNAL_STREAM_SRC:
+            if  external_src in content.src:
+                external_url = content.src
+                break
         
     # If project id is not set, we get the default project for the content
     if project_id is None or project_id == "_":
--- a/src/ldt/ldt/settings.py	Thu Feb 09 22:17:34 2012 +0100
+++ b/src/ldt/ldt/settings.py	Fri Feb 10 01:05:32 2012 +0100
@@ -93,3 +93,5 @@
 DEFAULT_PROJECT_ICON = "thumbnails/projects/project_default_icon.png"
 DEFAULT_USER_ICON = "thumbnails/users/user_default_icon.png"
 DEFAULT_GROUP_ICON = "thumbnails/groups/group_default_icon.png"
+
+EXTERNAL_STREAM_SRC = getattr(settings, 'EXTERNAL_STREAM_SRC', ['youtube.com', 'dailymotion.com'])
\ No newline at end of file
--- a/web/ldtplatform/settings.py	Thu Feb 09 22:17:34 2012 +0100
+++ b/web/ldtplatform/settings.py	Fri Feb 10 01:05:32 2012 +0100
@@ -238,6 +238,7 @@
           '??' : 'Q'
           }
 
+EXTERNAL_STREAM_SRC = ['youtube.com', 'dailymotion.com']
 
 from config import *