0004-django4-replaced-deprecated-request.is_ajax-call-685.patch
chrono/manager/views.py | ||
---|---|---|
140 | 140 |
FUTURE_BOOKING_ERROR_MSG = _('This cannot be removed as there are bookings for a future date.') |
141 | 141 | |
142 | 142 | |
143 |
def is_ajax(request): |
|
144 |
return request.headers.get('x-requested-with') == 'XMLHttpRequest' |
|
145 | ||
146 | ||
143 | 147 |
class HomepageView(ListView): |
144 | 148 |
template_name = 'chrono/manager_home.html' |
145 | 149 |
model = Agenda |
... | ... | |
2203 | 2207 |
return super().dispatch(request, *args, **kwargs) |
2204 | 2208 | |
2205 | 2209 |
def get_template_names(self): |
2206 |
if self.request.is_ajax():
|
|
2210 |
if is_ajax(self.request):
|
|
2207 | 2211 |
return ['chrono/manager_event_detail_fragment.html'] |
2208 | 2212 |
return ['chrono/manager_event_detail.html'] |
2209 | 2213 | |
... | ... | |
3197 | 3201 |
return ct |
3198 | 3202 | |
3199 | 3203 |
def response(self, request, booking): |
3200 |
if request.is_ajax():
|
|
3204 |
if is_ajax(request):
|
|
3201 | 3205 |
booking.absence_form = BookingCheckAbsenceForm( |
3202 | 3206 |
agenda=self.agenda, initial={'check_type': booking.user_check_type_slug} |
3203 | 3207 |
) |
3204 |
- |