GCal Mapping: Callback mechanism using channels

This commit is contained in:
Martin Bauer
2014-04-19 20:36:01 +02:00
committed by Martin Bauer
parent ba0cde09c1
commit fcb04058b5
16 changed files with 185 additions and 45 deletions

View File

@@ -116,8 +116,6 @@ class Event ( models.Model ):
return nextEvent
before_read = Signal()
class EventParticipation( models.Model ):
OPTIONS = ( ('?' , _('?' )),
@@ -147,10 +145,6 @@ class EventParticipation( models.Model ):
else:
return True
@staticmethod
def raiseBeforeReadSignal():
before_read.send( sender=EventParticipation )
@staticmethod
def isMember( user ):
return user.has_perm('eventplanner.member')

View File

@@ -6,13 +6,13 @@ from eventplanner.views import events_grid, eventplanning,event_api,EventUpdate,
urlpatterns = patterns('',
url(r'^$', eventplanning ),
url(r'^grid$', events_grid ),
url(r'^grid$', events_grid ),
url(r'^planning$', eventplanning ),
url(r'^(?P<pk>\d+)$', permission_required('eventplanner.change_event')( EventUpdate.as_view() ) ),
url(r'^add$', permission_required('eventplanner.add_event')( EventCreate.as_view() ) ),
url(r'^(?P<pk>\d+)/delete$', permission_required('eventplanner.delete_event')( deleteEvent ) ),
url(r'^api/', event_api, name="event_api" ),
url(r'^api/(\w+)/$', event_api, name="event_api_per_user" ),
url(r'^api/(\w+)/(\d+)$', event_api, name="event_api_per_user_event"),
url(r'^add$', permission_required('eventplanner.add_event' )( EventCreate.as_view() ) ),
url(r'^(?P<pk>\d+)/delete$', permission_required('eventplanner.delete_event')( deleteEvent ) ),
url(r'^api/', event_api, name="event_api" ),
url(r'^api/(\w+)/$', event_api, name="event_api_per_user" ),
url(r'^api/(\w+)/(\d+)$', event_api, name="event_api_per_user_event" ),
)

View File

@@ -61,7 +61,6 @@ def eventplanning( request ):
"""
View for a specific user, to edit his events
"""
EventParticipation.raiseBeforeReadSignal()
# non-members see the grid - but cannot edit anything
if not EventParticipation.isMember( request.user ):
return events_grid(request)
@@ -78,8 +77,6 @@ def eventplanning( request ):
def events_grid( request ):
EventParticipation.raiseBeforeReadSignal()
usernames = [ u.username for u in EventParticipation.members() ]
all_future_events = list ( Event.objects.filter( date__gte = datetime.date.today() ).order_by( 'date') )
@@ -135,7 +132,6 @@ class EventUpdate( UpdateView ):
class EventCreate( CreateView ):
form_class = EventForm
model = Event
template_name_suffix = "_update_form"