Skip to content

Commit

Permalink
fix broken unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
llazzaro committed Jul 11, 2015
1 parent 02a50b9 commit 09a3090
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions schedule/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import datetime
from urllib.parse import quote

from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.utils import timezone
Expand Down Expand Up @@ -206,6 +207,22 @@ def form_valid(self, form):
class DeleteEventView(EventEditMixin, DeleteView):
template_name = 'schedule/delete_event.html'

def get_context_data(self, **kwargs):
ctx = super(DeleteEventView, self).get_context_data(**kwargs)
ctx['next'] = self.get_success_url()
return ctx

def get_success_url(self):
"""
After the event is deleted there are three options for redirect, tried in
this order:
# Try to find a 'next' GET variable
# If the key word argument redirect is set
# Lastly redirect to the event detail of the recently create event
"""
next = self.kwargs.get('next') or reverse('day_calendar', args=[self.object.calendar.slug])
next = get_next_url(self.request, next)
return next

def get_occurrence(event_id, occurrence_id=None, year=None, month=None, day=None, hour=None, minute=None, second=None):
"""
Expand Down

0 comments on commit 09a3090

Please sign in to comment.