Skip to content

Commit

Permalink
Pulled events into browser. Have to make...
Browse files Browse the repository at this point in the history
subclasses for each type of event. ugh.
  • Loading branch information
Colin Sullivan committed Apr 8, 2011
1 parent 05dc7a9 commit 5ba6104
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
25 changes: 25 additions & 0 deletions concertapp/event/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,29 @@ class Meta:
authentication = DjangoAuthentication()

queryset = RequestJoinCollectionEvent.objects.all()

###
# The events for a single collection
###
class CollectionEventResource(EventResource):

class Meta(EventResource.Meta):

# The collection
collection = None

###
# Set the collection whose events we will retrieve.
###
def set_collection(self, collection):
self._meta.collection = collection


###
# Only retrieve events for a single collection
###
def apply_authorization_limits(self, request, object_list):
if not self._meta.collection:
raise Exception('You must call set_collection on this resource first')

return super(CollectionEventResource, self).apply_authorization_limits(request, object_list.filter(collection=self._meta.collection))
9 changes: 5 additions & 4 deletions concertapp/organize/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from concertapp.audiosegments.api import *
from concertapp.tags.api import *
from concertapp.comment.api import *
from concertapp.event.api import *


###
Expand Down Expand Up @@ -51,15 +52,15 @@ def organize_collection(request, collection_id, col, user):
singleCollectionResource = SingleCollectionResource()
singleCollectionResource.set_collection(col)

# commentResource = CollectionSegmentCommentResource()
# commentResource.set_collection(col)
collectionEventsResource = CollectionEventResource()
collectionEventsResource.set_collection(col)

data = {
'files': audioResource.as_dict(request),
'segments': segmentResource.as_dict(request),
'tags': tagsResource.as_dict(request),
'collection': singleCollectionResource.as_dict(request),
# 'segmentComments': commentResource.as_dict(request)
'events': collectionEventsResource.as_dict(request)
}

return TemplateResponse(request, 'organize/organize_collection.html', {
Expand Down

0 comments on commit 5ba6104

Please sign in to comment.