separate contest submission and regular submission

This commit is contained in:
zema1
2017-09-30 10:26:54 +08:00
parent 2a91fd5e9f
commit d650252a1a
9 changed files with 103 additions and 77 deletions

View File

@@ -18,7 +18,7 @@ class ContestAPI(APIView):
data["created_by"] = request.user
if data["end_time"] <= data["start_time"]:
return self.error("Start time must occur earlier than end time")
if not data["password"]:
if data.get("password") and data["password"] == "":
data["password"] = None
contest = Contest.objects.create(**data)
return self.success(ContestAdminSerializer(contest).data)