CodeSyntax
Auth needs to be pluggable
from rest_framework.authtoken.models import Token
token = Token.objects.create(user=...)
print token.key
# HTTP header
Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b
+
@api_view(['GET'])
def checkversion(request):
version_status = True
if request.method == 'GET':
version = request.GET.get('version')
try:
int_version = int(version.replace('.', ''))
except:
version = None
if version:
min_version = ControlPanel.get_minimal_version()
version_status = int_version >= min_version
return Response({'status': version_status}, status=status.HTTP_200_OK)