From 82e8ce3ea8e5f00118904189323882e59a23b344 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Thu, 24 Sep 2015 15:56:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=20ac=20=E6=A0=87=E5=BF=97=E5=AD=98=E5=82=A8=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- account/serializers.py | 6 ++++++ utils/models.py | 12 +----------- utils/templatetags/problem.py | 4 ++++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/account/serializers.py b/account/serializers.py index c2852a3c..ddd5aaba 100644 --- a/account/serializers.py +++ b/account/serializers.py @@ -46,3 +46,9 @@ class EditUserSerializer(serializers.Serializer): password = serializers.CharField(max_length=30, min_length=6, required=False, default=None) email = serializers.EmailField(max_length=254) admin_type = serializers.IntegerField(default=0) + + +class ApplyResetPasswordSerializer(serializers.Serializer): + username = serializers.CharField(max_length=30) + email = serializers.EmailField() + captcha = serializers.CharField(max_length=4, min_length=4) \ No newline at end of file diff --git a/utils/models.py b/utils/models.py index 671718c7..81858412 100644 --- a/utils/models.py +++ b/utils/models.py @@ -14,14 +14,4 @@ class RichTextField(models.TextField): parser = XssHtml() parser.feed(value) parser.close() - return parser.getHtml() - - -class JsonField(models.TextField): - __metaclass__ = models.SubfieldBase - - def get_prep_value(self, value): - return json.dumps(value) - - def to_python(self, value): - return json.loads(value) \ No newline at end of file + return parser.getHtml() \ No newline at end of file diff --git a/utils/templatetags/problem.py b/utils/templatetags/problem.py index 31d290df..1ccfa157 100644 --- a/utils/templatetags/problem.py +++ b/utils/templatetags/problem.py @@ -9,6 +9,9 @@ def get_problem_accepted_radio(problem): def get_problem_status(problems_status, problem_id): + # 用户没登陆 或者 user.problem_status 中没有这个字段都会到导致这里的problem_status 为 "" + if not problems_status: + return "" if str(problem_id) in problems_status: if problems_status[str(problem_id)] == 1: @@ -16,6 +19,7 @@ def get_problem_status(problems_status, problem_id): return "glyphicon glyphicon-minus dealing-flag" return "" + from django import template register = template.Library()