Merge branch 'virusdefender-dev'

This commit is contained in:
virusdefender 2015-11-08 23:16:56 +08:00
commit 34c4d5ae5b
7 changed files with 86 additions and 226 deletions

View File

@ -17,7 +17,7 @@ from utils.captcha import Captcha
from mail.tasks import send_email from mail.tasks import send_email
from .decorators import login_required from .decorators import login_required
from .models import User from .models import User, UserProfile
from .serializers import (UserLoginSerializer, UsernameCheckSerializer, from .serializers import (UserLoginSerializer, UsernameCheckSerializer,
UserRegisterSerializer, UserChangePasswordSerializer, UserRegisterSerializer, UserChangePasswordSerializer,
EmailCheckSerializer, UserSerializer, EditUserSerializer, EmailCheckSerializer, UserSerializer, EditUserSerializer,
@ -96,6 +96,7 @@ class UserRegisterAPIView(APIView):
email=data["email"]) email=data["email"])
user.set_password(data["password"]) user.set_password(data["password"])
user.save() user.save()
UserProfile.objects.create(user=user)
return success_response(u"注册成功!") return success_response(u"注册成功!")
else: else:
return serializer_invalid_response(serializer) return serializer_invalid_response(serializer)

View File

@ -26,6 +26,7 @@
// ------ admin web 组件 ---------- // ------ admin web 组件 ----------
pager: "components/pager", pager: "components/pager",
editorComponent: "components/editorComponent", editorComponent: "components/editorComponent",
testCaseUploader: "components/testCaseUploader",
// ------ 下面写的都不要直接用,而是使用上面的封装版本 ------ // ------ 下面写的都不要直接用,而是使用上面的封装版本 ------
//富文本编辑器simditor -> editor //富文本编辑器simditor -> editor

View File

@ -41,153 +41,5 @@
<ms:pager $id="contestListPager" config="pager"></ms:pager> <ms:pager $id="contestListPager" config="pager"></ms:pager>
</div> </div>
<!--
<div ms-visible="editingContestId">
<form id="edit-contest-form">
<div class="col-md-12">
<label>比赛名称</label>
</div>
<div class="col-md-12">
<div class="form-group">
<input type="text" name="name" class="form-control" ms-duplex="editTitle"
data-error="请填写比赛名称(名称不能超过50个字)" required>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-12">
<label>说明</label>
</div>
<div class="col-md-12">
<div class="form-group">
<textarea id="editor" placeholder="这里输入内容" autofocus ms-duplex="editDescription"></textarea>
<div class="help-block with-errors"></div>
<p class="error-info" ms-visible="editDescription==''">请填写比赛描述</p>
</div>
</div>
<div class="col-md-6">
<label>开始时间</label>
<div class="form-group">
<input type="text" class="form-control" name="start_time" id="contest_start_time"
ms-duplex="editStartTime" data-error="请填写比赛开始时间" required>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<label>结束时间</label>
<div class="form-group">
<input type="text" class="form-control" name="end_time" id="contest_end_time"
ms-duplex="editEndTime" data-error="请填写比赛结束时间" required>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>可见范围</label>
<span ms-if="showGlobalViewRadio">
<label>
<small><input type="radio" value="true" name="isGlobal" ms-duplex-boolean="isGlobal">全局可见
</small>
</label>
</span>
<span>
<label>
<small><input type="radio" value="false" name="isGlobal" ms-duplex-boolean="isGlobal">小组内可见
</small>
</label>
</span>
</div>
</div>
<div class="col-md-6" ms-visible="isGlobal">
<label>密码保护</label>
<input type="text" class="form-control" name="password" placeholder="留空就是公开赛" ms-duplex="editPassword">
</div>
<div class="form-group col-md-12" ms-visible="!isGlobal">
<div ms-repeat="allGroups" class="col-md-4">
<input type="checkbox" value="group_id" ms-duplex-checked="el.isSelected">&nbsp;&nbsp;{{ el.name }}
</div>
</div>
<div class="col-md-3">
<label>排名方式</label>
<div class="form-group">
<label><input type="radio" name="mode" ms-duplex-string="editMode" value="0">
<small>ACM</small>
</label>
<label><input type="radio" name="mode" ms-duplex-string="editMode" value="1">
<small>分数</small>
</label>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>是否可见</label>
<label><input type="checkbox" ms-duplex-checked="editVisible">
<small> 可见</small>
</label>
</div>
</div>
<div class="col-md-3">
<label>公开提交记录</label>
<div class="form-group">
<label class="text"><input type="checkbox" ms-duplex-checked="editShowSubmission">
<small>公开</small>
</label>
</div>
</div>
<div class="col-md-3">
<label>实时排名</label>
<div class="form-group">
<label class="text"><input type="checkbox" ms-duplex-checked="editRealTimeRank">
<small></small>
</label>
</div>
</div>
<div class="col-md-12">
<button class="btn btn-success" type="submit">保存修改</button>
</div>
</form>
</div>
<div class="col-md-12" ms-visible="editingProblemContestIndex">
<label>题目列表</label>
<a href="javascript:void(0)" class="btn btn-primary btn-sm" ms-click="addProblem()">添加题目</a>
<a href="javascript:void(0)" class="btn btn-info btn-sm" ms-click="showSubmissionPage()">查看提交</a>
<table class="table table-striped">
<tr>
<th>编号</th>
<th>题目</th>
<th ms-visible="editMode=='2'">分值</th>
<th>可见</th>
<th>创建时间</th>
<td></td>
</tr>
<tr ms-repeat="editProblemList">
<td>{{ el.sort_index }}</td>
<td>{{ el.title }}</td>
<td ms-visible="editMode=='2'">{{ el.score }}</td>
<td ms-text="el.visible?'可见':'不可见'"></td>
<td>{{ el.create_time|date("yyyy-MM-dd HH:mm:ss") }}</td>
<td>
<a href="javascript:void(0)" class="btn-sm btn-info"
ms-click="showProblemEditPage(el)">编辑</a>
<a href="javascript:void(0)" class="btn-sm btn-info"
ms-click="showSubmissionPage(el)">提交</a>
<a href="javascript:void(0)" class="btn-sm btn-info"
ms-click="addToProblemList(el)" ms-visible="admin_type=='2'">添加到前台</a>
</td>
</tr>
</table>
</div>
-->
</div> </div>
<script src="/static/js/app/admin/contest/contestList.js"></script> <script src="/static/js/app/admin/contest/contestList.js"></script>

View File

@ -27,7 +27,7 @@
<td>{{ el.total_accepted_number }}/{{ el.total_submit_number }}</td> <td>{{ el.total_accepted_number }}/{{ el.total_submit_number }}</td>
<td> <td>
<button class="btn-sm btn-info" ms-click="showEditProblemPage(el.id)">编辑</button> <button class="btn-sm btn-info" ms-click="showEditProblemPage(el.id)">编辑</button>
<button class="btn-sm btn-primary" ms-if="!el.is_public && adminType == 2" ms-click="makeProblemPublic(el)">公开</button> <button class="btn-sm btn-primary" ms-if="!el.is_public && adminType == 2 && el.visible" ms-click="makeProblemPublic(el)">公开</button>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -14,8 +14,7 @@
</ul> </ul>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<img src="https://coding.net/static/fruit_avatar/Fruit-1.png" class="img-responsive" <img src="{{ user.userprofile.avatar }}" class="img-responsive index-avatar">
style="height: 200px;width: 200px;">
</div> </div>
<div class="col-lg-6"> <div class="col-lg-6">
<form> <form>
@ -23,24 +22,20 @@
<div class="form-group col-md-6"><label>用户名</label> <div class="form-group col-md-6"><label>用户名</label>
<input name="username" type="text" class="form-control" <input name="username" type="text" class="form-control"
value="{{ request.user.username }}" readonly> value="{{ request.user.username }}" readonly>
</div> </div>
<div class="form-group col-md-6"><label>真实姓名</label> <div class="form-group col-md-6"><label>真实姓名</label>
<input name="real_name" type="text" class="form-control" <input name="real_name" type="text" class="form-control"
value="{{ request.user.real_name }}" readonly> value="{{ request.user.real_name }}" readonly>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-md-6"><label>电子邮箱</label> <div class="form-group col-md-6"><label>电子邮箱</label>
<input name="email" type="email" class="form-control" <input name="email" type="email" class="form-control"
value="{{ request.user.email }}" readonly> value="{{ request.user.email }}" readonly>
<div class="help-block with-errors"></div>
</div> </div>
<div class="form-group col-md-6"><label>手机</label> <div class="form-group col-md-6"><label>手机</label>
<input name="phone" type="text" class="form-control" <input name="phone" type="text" class="form-control"
data-error="请填写手机号码" value="{{ request.user.phone }}"> data-error="请填写手机号码" value="{{ request.user.phone }}">
<div class="help-block with-errors"></div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -49,23 +44,27 @@
<label>hduoj 用户名</label> <label>hduoj 用户名</label>
<input name=hduoj" type="text" class="form-control" <input name=hduoj" type="text" class="form-control"
value="{{ request.user.hduoj_username }}"> value="{{ request.user.hduoj_username }}">
<div class="help-block with-errors"></div> <div class="help-block with-errors"></div>
</div> </div>
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label>BestCoder 用户名</label> <label>BestCoder 用户名</label>
<input name=bestcoder" type="text" class="form-control" <input name=bestcoder" type="text" class="form-control"
value="{{ request.user.bestcoder_username }}"> value="{{ request.user.bestcoder_username }}">
<div class="help-block with-errors"></div> <div class="help-block with-errors"></div>
</div> </div>
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label>Codeforces 用户名</label> <label>Codeforces 用户名</label>
<input name=codeforces" type="text" class="form-control" <input name=codeforces" type="text" class="form-control"
value="{{ request.user.bestcoder_username }}"> value="{{ request.user.bestcoder_username }}">
<div class="help-block with-errors"></div> <div class="help-block with-errors"></div>
</div> </div>
<div class="form-group col-md-12"><label>blog</label> <div class="form-group col-md-12"><label>blog</label>
<input name=blog" type="url" class="form-control" <input name=blog" type="url" class="form-control"
value="{{ request.user.blog }}"> value="{{ request.user.blog }}">
<div class="help-block with-errors"></div> <div class="help-block with-errors"></div>
</div> </div>
</div> </div>

View File

@ -19,7 +19,9 @@
{% endifequal %} {% endifequal %}
</h2> </h2>
{% if user.userprofile.mood %}
<p id="user-mood">{{ user.userprofile.mood }}</p> <p id="user-mood">{{ user.userprofile.mood }}</p>
{% endif %}
</div> </div>
<div class="list-group col-lg-9"> <div class="list-group col-lg-9">
@ -61,15 +63,17 @@
{{ user.create_time }} {{ user.create_time }}
</p> </p>
<div class="rows"> <div class="rows">
<!--
<div class="col-lg-4 text-center"> <div class="col-lg-4 text-center">
<strong id="user-data-number">{{ user.userprofile.rank }}</strong> <strong id="user-data-number">{{ user.userprofile.rank }}</strong>
<span id="user-data-text">Rank</span> <span id="user-data-text">Rank</span>
</div> </div>
<div class="col-lg-4 text-center"> -->
<div class="col-lg-6 text-center">
<strong id="user-data-number">{{ user.userprofile.accepted_number }}</strong> <strong id="user-data-number">{{ user.userprofile.accepted_number }}</strong>
<span id="user-data-text">AC</span> <span id="user-data-text">AC</span>
</div> </div>
<div class="col-lg-4 text-center"> <div class="col-lg-6 text-center">
<strong id="user-data-number">{{ user.userprofile.submissions_number }}</strong> <strong id="user-data-number">{{ user.userprofile.submissions_number }}</strong>
<span id="user-data-text">Submissions</span> <span id="user-data-text">Submissions</span>
</div> </div>

View File

@ -90,6 +90,9 @@
</nav> </nav>
{% else %} {% else %}
<p>还没有结果</p> <p>还没有结果</p>
<input type="checkbox" id="auto-refresh" {% if auto_refresh %}checked{% endif %}
onchange="if(this.checked){location.href=location.href + '&auto_refresh=true'}else{location.href=location.href=location.href.replace('&auto_refresh=true', '')}">
自动刷新
{% endif %} {% endif %}
</div> </div>