From f2bc52f2fce17a86fdbe95b4a63787f16eb64520 Mon Sep 17 00:00:00 2001 From: "fergal.moran" Date: Tue, 21 Aug 2012 11:49:50 +0100 Subject: [PATCH] Added favourites to mix screen --- _working/create | 0 dss/settings.py | 2 ++ spa/api/v1/MixResource.py | 2 +- spa/models/Mix.py | 6 ++++-- static/bin/sm/soundmanager2.swf | Bin static/bin/sm/soundmanager2_debug.swf | Bin static/bin/sm/soundmanager2_flash9.swf | Bin static/bin/sm/soundmanager2_flash9_debug.swf | Bin static/bin/sm/soundmanager2_flash_xdomain.zip | Bin templates/inc/fb_like.html | 1 - templates/views/MixListView.html | 3 +++ 11 files changed, 10 insertions(+), 4 deletions(-) mode change 100755 => 100644 _working/create mode change 100755 => 100644 static/bin/sm/soundmanager2.swf mode change 100755 => 100644 static/bin/sm/soundmanager2_debug.swf mode change 100755 => 100644 static/bin/sm/soundmanager2_flash9.swf mode change 100755 => 100644 static/bin/sm/soundmanager2_flash9_debug.swf mode change 100755 => 100644 static/bin/sm/soundmanager2_flash_xdomain.zip diff --git a/_working/create b/_working/create old mode 100755 new mode 100644 diff --git a/dss/settings.py b/dss/settings.py index 9aa14da..d922495 100644 --- a/dss/settings.py +++ b/dss/settings.py @@ -109,6 +109,7 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.gzip.GZipMiddleware', + 'debug_toolbar.middleware.DebugToolbarMiddleware', #'pipeline.middleware.MinifyHTMLMiddleware' ) @@ -127,6 +128,7 @@ INSTALLED_APPS = ( 'django.contrib.admindocs', 'django_facebook', 'djcelery', + 'debug_toolbar', 'crispy_forms', 'sorl.thumbnail', #'pipeline', diff --git a/spa/api/v1/MixResource.py b/spa/api/v1/MixResource.py index f2735e2..0365fe7 100644 --- a/spa/api/v1/MixResource.py +++ b/spa/api/v1/MixResource.py @@ -22,7 +22,7 @@ class MixResource(BackboneCompatibleResource): if 'sort' in request.GET and request.GET['sort']: sort = request.GET['sort'] - return Mix.get_listing(sort) + return Mix.get_listing(sort, request.user) def dehydrate_mix_image(self, bundle): return bundle.obj.get_image() diff --git a/spa/models/Mix.py b/spa/models/Mix.py index 0ae3952..872e38f 100644 --- a/spa/models/Mix.py +++ b/spa/models/Mix.py @@ -61,7 +61,7 @@ class Mix(_BaseModel): return settings.MEDIA_URL + self.local_file.name @classmethod - def get_listing(cls, listing_type): + def get_listing(cls, listing_type, user=None): queryset = None if listing_type == 'latest': queryset = Mix.objects.all().order_by( 'id') @@ -79,7 +79,9 @@ class Mix(_BaseModel): .order_by('-karma') elif listing_type == 'recommended': queryset = Mix.objects.all().order_by( '-id') - + elif listing_type == 'favourites': + queryset = Mix.objects.filter(favourites__user=user).order_by('favourites__date') + debug = queryset.query return queryset @classmethod diff --git a/static/bin/sm/soundmanager2.swf b/static/bin/sm/soundmanager2.swf old mode 100755 new mode 100644 diff --git a/static/bin/sm/soundmanager2_debug.swf b/static/bin/sm/soundmanager2_debug.swf old mode 100755 new mode 100644 diff --git a/static/bin/sm/soundmanager2_flash9.swf b/static/bin/sm/soundmanager2_flash9.swf old mode 100755 new mode 100644 diff --git a/static/bin/sm/soundmanager2_flash9_debug.swf b/static/bin/sm/soundmanager2_flash9_debug.swf old mode 100755 new mode 100644 diff --git a/static/bin/sm/soundmanager2_flash_xdomain.zip b/static/bin/sm/soundmanager2_flash_xdomain.zip old mode 100755 new mode 100644 diff --git a/templates/inc/fb_like.html b/templates/inc/fb_like.html index 1f858f9..3cd0049 100644 --- a/templates/inc/fb_like.html +++ b/templates/inc/fb_like.html @@ -9,7 +9,6 @@ - diff --git a/templates/views/MixListView.html b/templates/views/MixListView.html index 571b63d..923043d 100644 --- a/templates/views/MixListView.html +++ b/templates/views/MixListView.html @@ -4,5 +4,8 @@
  • Most Played
  • Most Active
  • Recommended
  • + {% if user.is_authenticated %} +
  • Favourites
  • + {% endif %}
    \ No newline at end of file