如何配置django静态文件路径
django-restful请求的访问限制

django如何使用restful风格

妙音 posted @ 2015年6月06日 15:24 in django with tags python , 2155 阅读
个人比较喜欢restful风格,以为django要安装rest framework才支持restful. 偶然发现只需继承View类即可.
 
from django.views.generic import View

class TaskView(View):
    # 获取
    def get(self, request, *args, **kwargs):
        print request.GET
    # 新建
    def post(self, request, *args, **kwargs):
        print request.POST
    # 更新
    def put(self, request, *args, **kwargs):
        print request.body
    # 删除
    def delete(self, request, *args, **kwargs):
        print request.body

# 路径配置
#url(r'task/$', TaskView.as_view())
 
Avatar_small
Robinjack 说:
2020年12月23日 17:35

When I originally commented I clicked the -Notify me when new comments are added- checkbox and after this whenever a comment is added I get four emails with the same comment. Could there be however you possibly can get rid of me from that service? Thanks! medical masks for cancer patients

Avatar_small
apple.com bill 说:
2023年7月14日 22:41

Apple inattendus qui se manifestent sous la forme de SMS ou d’e-mails. Ces types de paiements inconnus sont généralement consultés sur Apple bill pour leurs clients Apple ID demandant des informations sur les transactions mensuelles et annuelles sur les relevés bancaires. apple.com bill Lorsque vous achetez du contenu comme une application, de la musique, un film ou d’autres contenus d’Apple, le site Web Apple bill apporte votre relevé de facturation ainsi que. Pour observer vos articles achetés.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter