Skip to content

Instantly share code, notes, and snippets.

@jackeyGao
Created July 8, 2016 06:48
Show Gist options
  • Save jackeyGao/0f68aa96dc37d937ab4445ba35466aad to your computer and use it in GitHub Desktop.
Save jackeyGao/0f68aa96dc37d937ab4445ba35466aad to your computer and use it in GitHub Desktop.
Django 获取查询参数通用函数
def get_args(request, excludes):
args = {}
for i in request.GET:
if i in excludes:
continue
value = request.GET.getlist(i)
if len(value) == 1:
args[i] = value[0]
else:
args[i] = value
return args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment