Move real_name to UserProfile;
Delete student_id field; Mark the problems that have submission; Alter dispatcher to adapt the changes.
This commit is contained in:
@@ -82,10 +82,7 @@ class Captcha(object):
|
||||
x += font_size * random.randrange(6, 8) / 10
|
||||
|
||||
self.django_request.session[self.session_key] = "".join(code)
|
||||
with BytesIO() as buf:
|
||||
image.save(buf, "gif")
|
||||
buf_str = buf.getvalue()
|
||||
return buf_str
|
||||
return image
|
||||
|
||||
def check(self, code):
|
||||
"""
|
||||
|
||||
@@ -2,10 +2,9 @@ from base64 import b64encode
|
||||
|
||||
from . import Captcha
|
||||
from ..api import APIView
|
||||
from ..shortcuts import img2base64
|
||||
|
||||
|
||||
class CaptchaAPIView(APIView):
|
||||
def get(self, request):
|
||||
img_prefix = "data:image/png;base64,"
|
||||
img = img_prefix + b64encode(Captcha(request).get()).decode("utf-8")
|
||||
return self.success(img)
|
||||
return self.success(img2base64(Captcha(request).get()))
|
||||
|
||||
Reference in New Issue
Block a user