Total Complexity | 2 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
2 | # -*- coding: utf-8 -*- |
||
3 | """ |
||
4 | Created on Mon Mar 18 12:21:07 2019 |
||
5 | |||
6 | @author: Paolo Cozzi <[email protected]> |
||
7 | """ |
||
8 | |||
9 | from django.http import HttpResponseBadRequest |
||
10 | |||
11 | |||
12 | def ajax_required(f): |
||
13 | def wrap(request, *args, **kwargs): |
||
14 | if not request.is_ajax(): |
||
15 | return HttpResponseBadRequest() |
||
16 | |||
17 | return f(request, *args, **kwargs) |
||
18 | |||
19 | wrap.__doc__ = f.__doc__ |
||
20 | wrap.__name__ = f.__name__ |
||
21 | |||
22 | return wrap |
||
23 |