django4: replaced deprecated request.is_ajax() call (#68593)
This commit is contained in:
parent
cb7b1f3ca3
commit
d3fcbfc051
|
@ -140,6 +140,10 @@ from .utils import export_site, import_site
|
|||
FUTURE_BOOKING_ERROR_MSG = _('This cannot be removed as there are bookings for a future date.')
|
||||
|
||||
|
||||
def is_ajax(request):
|
||||
return request.headers.get('x-requested-with') == 'XMLHttpRequest'
|
||||
|
||||
|
||||
class HomepageView(ListView):
|
||||
template_name = 'chrono/manager_home.html'
|
||||
model = Agenda
|
||||
|
@ -2203,7 +2207,7 @@ class EventDetailView(ViewableAgendaMixin, DetailView):
|
|||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_template_names(self):
|
||||
if self.request.is_ajax():
|
||||
if is_ajax(self.request):
|
||||
return ['chrono/manager_event_detail_fragment.html']
|
||||
return ['chrono/manager_event_detail.html']
|
||||
|
||||
|
@ -3197,7 +3201,7 @@ class BookingCheckMixin:
|
|||
return ct
|
||||
|
||||
def response(self, request, booking):
|
||||
if request.is_ajax():
|
||||
if is_ajax(request):
|
||||
booking.absence_form = BookingCheckAbsenceForm(
|
||||
agenda=self.agenda, initial={'check_type': booking.user_check_type_slug}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue