-
Notifications
You must be signed in to change notification settings - Fork 0
Home
#Welcome to the Purified wiki! 我们在这里规定数据格式
A service aiming at purified you reading list.
由于采用了csrf方式保护用户免受跨站攻击,我们的每次post都需要先get一个token,用这个token 去post数据
目前提供了这几个form表单,__每次post都必须按照这个格式post__否则会验证失败
以下是后台的model,对大家来说只有名字,如LoginForm的username,password是有用的,另外注意一下类型,charfield是字符,boolean需要做成checkbox。
看起来像这样: csrftoken:eY1KzEIvgMEv3jOIZcQ5kCOWIEbcApRB sessionid:q7wqz951cwzmf6rlpkbze000jqy3jyn0
class LoginForm(forms.Form):
username=forms.CharField(max_length=50)
password=forms.CharField(max_length=50)
next=forms.CharField(max_length=50,required=False)
class CreateUserForm(forms.Form):
username=forms.CharField(max_length=50)
email=forms.EmailField()
password=forms.CharField(max_length=50)
gender=forms.CharField(required=False)
age=forms.IntegerField(required=False)
class CreateRepo(forms.Form):
url=forms.CharField(max_length=1024)
div=forms.CharField(max_length=128)
content=forms.CharField(max_length=1048576)
needPushAfterChange=forms.BooleanField()
keyword=forms.CharField(max_length=128)
#逗号分隔的categoryID
category=forms.CharField(max_length=128)
class CreateCategory(forms.Form):
name=forms.CharField(max_length=128)
isPublic=forms.BooleanField()
url访问资源的规约 r'XXXXX'是正则表达式,表示命中的url指到哪一个处理函数里
url(r'^accounts/login/$', 'puriserver.views.loginView'),
url(r'^accounts/logout/$', 'puriserver.views.logoutView'),
url(r'^registration/$','puriserver.views.registrationView'),
url(r'^repo/$',views.repoView),
url(r'^repoList/$',views.repoListView),
url(r'^categoryList/$',views.categoryListView),
url(r'^category/$',views.categoryView),
create by ZhaoGuoquan in 20140624
2014年6月24日 20:20
##登录模块 url = server url
data={ "email":"[email protected]",
"password":"[email protected]"
}
a_post(url, data)
##注册模块json格式 url = server url
data={ "email":"[email protected]",
"password":"[email protected]"
"sex":"M"(or F),
"birthYear":1994
}
a_post(url, data)
data={ "email:"email",
"password:"password",
"url":"www.baidu.com"
"isDivActivated":0,
"divID":"div_id",
"divContent":"content",
"needPushAfterSourceChange":0 or 1,
"keyword":["someCOntent","someContent","someContent"]
}