mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-01-01 10:02:01 +00:00
592720dd01
包括用户model、用户登录模板、登录api和测试。
14 lines
329 B
Python
14 lines
329 B
Python
# coding=utf-8
|
|
from rest_framework.response import Response
|
|
|
|
|
|
def error_response(error_reason):
|
|
return Response(data={"code": 1, "data": error_reason})
|
|
|
|
|
|
def serializer_invalid_response(serializer):
|
|
return error_response(serializer.errors)
|
|
|
|
|
|
def success_response(data):
|
|
return Response(data={"code": 0, "data": data}) |