Dondariadmin (トーク | 投稿記録) 細 |
Dondariadmin (トーク | 投稿記録) 細 |
||
15行目: | 15行目: | ||
== コード == | == コード == | ||
− | * [https://gist.github.com/shinsaka/097800f6b4525538fe846a3fb1e0614b | + | * [https://gist.github.com/shinsaka/097800f6b4525538fe846a3fb1e0614b gist: shinsaka/ajax_required_decorator.py] |
== 具体的には == | == 具体的には == |
from django.http import HttpResponseBadRequest from utils.decorators import ajax_required @ajax_required(HttpResponseBadRequest()) def index(request): # any code
$ curl --head http://localhost:5000/app/index/ HTTP/1.1 200 OK ...
$ curl --head http://localhost:5000/app/index/ HTTP/1.1 400 Bad Request ...Tweet