Fixed modals on non-home page

This commit is contained in:
Fergal Moran
2013-07-01 10:02:30 +01:00
parent 76c5e4e878
commit 2adf3da5c2
781 changed files with 94 additions and 44 deletions

0
.gitignore vendored Executable file → Normal file
View File

0
LICENSE Executable file → Normal file
View File

0
README Executable file → Normal file
View File

0
_working/create Executable file → Normal file
View File

0
_working/get_downloads.sql Executable file → Normal file
View File

0
_working/get_plays.sql Executable file → Normal file
View File

0
apache/django_live.wsgi Executable file → Normal file
View File

0
core/__init__.py Executable file → Normal file
View File

0
core/analytics/__init__.py Executable file → Normal file
View File

0
core/analytics/google.py Executable file → Normal file
View File

0
core/decorators.py Executable file → Normal file
View File

0
core/serialisers/__init__.py Executable file → Normal file
View File

0
core/serialisers/json.py Executable file → Normal file
View File

0
core/tasks.py Executable file → Normal file
View File

0
core/tests/__init__.py Executable file → Normal file
View File

0
core/tests/mix.py Executable file → Normal file
View File

0
core/utils/__init__.py Executable file → Normal file
View File

0
core/utils/audio/__init__.py Executable file → Normal file
View File

0
core/utils/audio/mp3.py Executable file → Normal file
View File

0
core/utils/file.py Executable file → Normal file
View File

0
core/utils/html.py Executable file → Normal file
View File

0
core/utils/live.py Executable file → Normal file
View File

0
core/utils/string.py Executable file → Normal file
View File

0
core/utils/url.py Executable file → Normal file
View File

0
core/utils/waveform.py Executable file → Normal file
View File

0
core/widgets/__init__.py Executable file → Normal file
View File

0
core/widgets/upload.py Executable file → Normal file
View File

0
dss/__init__.py Executable file → Normal file
View File

0
dss/localsettings.initial.py Executable file → Normal file
View File

0
dss/logsettings.py Executable file → Normal file
View File

0
dss/settings.py Executable file → Normal file
View File

0
dss/urls.py Executable file → Normal file
View File

0
dss/warning_settings.py Executable file → Normal file
View File

0
dss/wsgi.py Executable file → Normal file
View File

0
index.html Executable file → Normal file
View File

0
manage.py Executable file → Normal file
View File

0
pip_upgrade.py Executable file → Normal file
View File

0
requirements.txt Executable file → Normal file
View File

0
spa/__init__.py Executable file → Normal file
View File

0
spa/admin.py Executable file → Normal file
View File

0
spa/ajax.py Executable file → Normal file
View File

0
spa/api/__init__.py Executable file → Normal file
View File

0
spa/api/v1/ActivityResource.py Executable file → Normal file
View File

0
spa/api/v1/BackboneCompatibleResource.py Executable file → Normal file
View File

0
spa/api/v1/ChatResource.py Executable file → Normal file
View File

0
spa/api/v1/CommentResource.py Executable file → Normal file
View File

View File

@@ -0,0 +1,18 @@
from django.db.models import Count
from tastypie import fields
from tastypie.resources import ModelResource
from spa.models import UserProfile
class DebugResource(ModelResource):
total_tickets = fields.IntegerField(readonly=True)
class Meta:
queryset = UserProfile.objects.all()
ordering = ['total_tickets']
def get_object_list(self, request):
return super(DebugResource, self).get_object_list(request).annotate(total_tickets=Count('mixes', distinct=True))
def dehydrate_total_tickets(self, bundle):
return bundle.obj.total_tickets

0
spa/api/v1/EventResource.py Executable file → Normal file
View File

0
spa/api/v1/MixResource.py Executable file → Normal file
View File

0
spa/api/v1/ReleaseAudioResource.py Executable file → Normal file
View File

0
spa/api/v1/ReleaseResource.py Executable file → Normal file
View File

24
spa/api/v1/UserResource.py Executable file → Normal file
View File

@@ -1,31 +1,33 @@
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.db.models import Count
import humanize
from tastypie import fields
from tastypie.authentication import Authentication
from tastypie.authorization import DjangoAuthorization
from django.conf.urls import url
from tastypie.http import HttpMultipleChoices, HttpGone
from tastypie.paginator import Paginator
from tastypie.utils import trailing_slash
from spa.api.v1.BackboneCompatibleResource import BackboneCompatibleResource
from spa.api.v1.MixResource import MixResource
from spa.models import UserProfile, Mix
from spa.models.userprofile import UserProfile
from spa.models.mix import Mix
class UserProfileResource(BackboneCompatibleResource):
mix_count = fields.IntegerField(readonly=True)
class Meta:
queryset = UserProfile.objects.annotate(fcount=Count('followers'))
queryset = UserProfile.objects.all()
resource_name = 'profile'
include_resource_uri = False
include_absolute_url = False
always_return_data = True
authorization = DjangoAuthorization()
authentication = Authentication()
order_by = "-last_login"
ordering = ["-last_login"]
def get_object_list(self, request):
return super(UserProfileResource, self).get_object_list(request).annotate(mix_count=Count('mixes'))
def _hydrateBitmapOption(self, source, comparator):
return True if (source & comparator) != 0 else False
@@ -84,20 +86,22 @@ class UserProfileResource(BackboneCompatibleResource):
self._hydrateBitmapOption(bundle.obj.activity_sharing_networks,
UserProfile.ACTIVITY_SHARE_NETWORK_TWITTER)
bundle.data['mix_count'] = Mix.objects.filter(user=bundle.obj).count()
bundle.data['like_count'] = Mix.objects.filter(likes__user=bundle.obj).count()
bundle.data['favourite_count'] = Mix.objects.filter(favourites__user=bundle.obj).count()
bundle.data['follower_count'] = bundle.obj.followers.count()
bundle.data['following_count'] = bundle.obj.following.count()
bundle.data['following'] = bundle.obj.is_follower(bundle.request.user)
bundle.data['url'] = bundle.obj.get_profile_url()
return bundle
def dehydrate_mix_count(self, bundle):
return bundle.obj.mixes.count()
class UserResource(BackboneCompatibleResource):
profile = fields.ToOneField(UserProfileResource, attribute='userprofile', related_name='user', full=True)
class Meta:
queryset = User.objects.all().order_by('-last_login')
queryset = User.objects.all()
resource_name = 'user'
excludes = ['is_active', 'is_staff', 'is_superuser', 'password']
authorization = DjangoAuthorization()
@@ -115,6 +119,9 @@ class UserResource(BackboneCompatibleResource):
self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
def apply_sorting(self, obj_list, options=None):
return super(UserResource, self).apply_sorting(obj_list, options)
def get_object_list(self, request):
return super(UserResource, self).get_object_list(request)
@@ -134,5 +141,4 @@ class UserResource(BackboneCompatibleResource):
if bundle.obj.id != bundle.request.user.id:
del bundle.data['email']
del bundle.data['username']
return bundle

0
spa/api/v1/__init__.py Executable file → Normal file
View File

0
spa/api/v1/tests.py Executable file → Normal file
View File

0
spa/audio.py Executable file → Normal file
View File

0
spa/context_processors.py Executable file → Normal file
View File

0
spa/forms.py Executable file → Normal file
View File

0
spa/management/__init__.py Executable file → Normal file
View File

0
spa/management/commands/__init__.py Executable file → Normal file
View File

0
spa/management/commands/__template_Debug.py Executable file → Normal file
View File

0
spa/management/commands/debugHumanize.py Executable file → Normal file
View File

0
spa/management/commands/debugUserProfile.py Executable file → Normal file
View File

0
spa/management/commands/deletefailed.py Executable file → Normal file
View File

0
spa/management/commands/deleteorphanmp3.py Executable file → Normal file
View File

0
spa/management/commands/drop.py Executable file → Normal file
View File

0
spa/management/commands/importdownloads.py Executable file → Normal file
View File

0
spa/management/commands/importplays.py Executable file → Normal file
View File

0
spa/management/commands/processmix.py Executable file → Normal file
View File

0
spa/management/commands/processuser.py Executable file → Normal file
View File

0
spa/management/commands/purchaselinks.py Executable file → Normal file
View File

0
spa/management/commands/tracklists.py Executable file → Normal file
View File

0
spa/management/commands/waveforms.py Executable file → Normal file
View File

0
spa/middleware/__init__.py Executable file → Normal file
View File

0
spa/middleware/sqlprinter.py Executable file → Normal file
View File

0
spa/middleware/stripwhitespace.py Executable file → Normal file
View File

0
spa/middleware/uploadify.py Executable file → Normal file
View File

0
spa/migrations/0001_initial.py Executable file → Normal file
View File

0
spa/migrations/0002_auto__add_userfollows.py Executable file → Normal file
View File

0
spa/migrations/0003_auto__add_field_mix_duration.py Executable file → Normal file
View File

0
spa/migrations/0004_auto__add_field_mix_slug.py Executable file → Normal file
View File

View File

0
spa/migrations/0006_auto__chg_field_mix_title.py Executable file → Normal file
View File

View File

View File

0
spa/migrations/0010_auto.py Executable file → Normal file
View File

0
spa/migrations/0011_auto__del_field__activity_user.py Executable file → Normal file
View File

0
spa/migrations/0012_auto__add_field__activity_user.py Executable file → Normal file
View File

View File

View File

View File

0
spa/migrations/0016_auto__del_mixlike.py Executable file → Normal file
View File

0
spa/migrations/0017_auto__add_mixlike.py Executable file → Normal file
View File

0
spa/migrations/0019_auto__add_activityfavourite.py Executable file → Normal file
View File

0
spa/migrations/0020_auto__add_activityplay.py Executable file → Normal file
View File

0
spa/migrations/0021_auto__add_activitylike.py Executable file → Normal file
View File

0
spa/migrations/0022_auto__add_activitydownload.py Executable file → Normal file
View File

0
spa/migrations/__init__.py Executable file → Normal file
View File

Some files were not shown because too many files have changed in this diff Show More