0001-agenda-raising-Http404-if-event-is-canceled.patch
calebasse/agenda/views.py | ||
---|---|---|
7 | 7 |
from django.contrib import messages |
8 | 8 |
from django.db.models import Q |
9 | 9 |
from django.shortcuts import redirect, get_object_or_404 |
10 |
from django.http import HttpResponseRedirect, HttpResponse |
|
10 |
from django.http import HttpResponseRedirect, HttpResponse, Http404
|
|
11 | 11 |
from django.conf import settings |
12 | 12 | |
13 | 13 |
from calebasse.cbv import TemplateView, CreateView, UpdateView |
... | ... | |
166 | 166 |
class TodayOccurrenceMixin(object): |
167 | 167 |
def get_object(self, queryset=None): |
168 | 168 |
o = super(TodayOccurrenceMixin, self).get_object(queryset) |
169 |
return o.today_occurrence(self.date) |
|
169 |
obj = o.today_occurrence(self.date) |
|
170 |
if obj: |
|
171 |
return obj |
|
172 |
raise Http404 |
|
170 | 173 | |
171 | 174 | |
172 | 175 |
class BaseAppointmentView(UpdateView): |
... | ... | |
204 | 207 |
else: |
205 | 208 |
return self.form_class |
206 | 209 | |
207 | ||
208 | 210 |
class UpdatePeriodicAppointmentView(BaseAppointmentView): |
209 | 211 |
form_class = UpdatePeriodicAppointmentForm |
210 | 212 |
template_name = 'agenda/new-appointment.html' |
211 |
- |