Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some functions、Fix some bugs #253

Open
wants to merge 176 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
69d487c
add only admin in user page
BBBob Mar 19, 2019
b373dae
delete blank line contains whitespace
BBBob Mar 19, 2019
1d52d6e
fix over-indented in test file
BBBob Mar 19, 2019
db3b3fa
Remove bad quotes
BBBob Mar 19, 2019
0d354d8
add username directory and contest name for submission download
BBBob Mar 25, 2019
efc4f3f
download the latest submission for OI mode
BBBob Mar 26, 2019
3242c56
support Chinese contest name for submission download
BBBob Mar 27, 2019
aa5673b
Merge branch 'download_submission' of https://github.com/BBBob/Online…
Harry-zklcdc Apr 4, 2019
4bd37f9
Merge branch 'BBBob-download_submission'
Harry-zklcdc Apr 4, 2019
ccaebba
完善代码下载功能
Harry-zklcdc Apr 4, 2019
ee4e9f6
修改dist源
Harry-zklcdc Apr 4, 2019
a1b6626
Merge pull request #3 from QingdaoU/master
Harry-zklcdc Apr 4, 2019
d00648a
Merge pull request #4 from QingdaoU/master
Harry-zklcdc Apr 5, 2019
7813c2b
修改language列表
Harry-zklcdc Apr 5, 2019
522c2fd
Merge pull request #5 from QingdaoU/master
Harry-zklcdc Apr 16, 2019
a03493f
Update README.md
Harry-zklcdc Apr 19, 2019
3c21ab9
change [Build Status]
Harry-zklcdc Apr 19, 2019
5251ef5
添加关于我们(未完成)
Apr 28, 2019
1128f62
Merge branch 'master' of https://github.com/Harry-zklcdc/OnlineJudge
Apr 28, 2019
0e1dc73
添加关于我们(未完成)
Apr 28, 2019
80fae07
添加关于我们(未完成)
Harry-zklcdc Apr 28, 2019
80e98ba
添加关于我们(未完成)
Harry-zklcdc Apr 28, 2019
5df6867
移植“编辑关于我们”至系统配置
Apr 29, 2019
1ec09a4
遵循代码规范
Harry-zklcdc Apr 29, 2019
d8e36a1
遵循代码规范
Harry-zklcdc Apr 29, 2019
22d2ab9
修改pg数据库地址
Harry-zklcdc Apr 29, 2019
8634151
fix test
Harry-zklcdc Apr 29, 2019
5370c94
修改pg数据库地址,使其可以内网访问
Harry-zklcdc Apr 29, 2019
5dbd8ee
增加“About Us API”
Harry-zklcdc May 1, 2019
0140cce
fix bugs
Harry-zklcdc May 1, 2019
d64e10f
fix bugs
Harry-zklcdc May 1, 2019
68cb328
fix'About Us API' Bug
Harry-zklcdc May 1, 2019
cf6fbdd
fix'About Us API' Bug
Harry-zklcdc May 1, 2019
2596b31
Merge remote-tracking branch 'upstream/master'
Harry-zklcdc May 1, 2019
775ece9
修改前台关于我们不存在时的返回值
Harry-zklcdc May 1, 2019
8c6ed1e
修改初始化选项
Harry-zklcdc May 1, 2019
9150053
fix bugs
Harry-zklcdc May 1, 2019
431847e
添加在线IDE功能(测试)
May 5, 2019
f606583
fix bugs
May 5, 2019
4bd5078
fix bugs
May 5, 2019
c66c31f
fix bugs
May 5, 2019
bc6ba0e
fix bugs
May 6, 2019
e53c662
fix bugs
May 6, 2019
5bd3a7f
修改在线IDE功能(测试)
May 7, 2019
0d6880d
fix bugs
May 7, 2019
4ab80fa
fix bugs
May 7, 2019
7627199
fix bugs
May 10, 2019
9b1fc05
fix bugs
May 10, 2019
13d09cc
fix bugs
May 10, 2019
12ec4df
fix bugs
May 10, 2019
79459ab
fix bugs
May 10, 2019
68eb023
添加在线IDE功能(后端已完成)
May 11, 2019
3f7aaf0
fix SubmissionList[Problem] display error
Harry-zklcdc May 18, 2019
1f5dcf4
修改中文readme
Harry-zklcdc Jul 9, 2019
13fdd1a
修改英文readme
Harry-zklcdc Jul 9, 2019
6c0cb62
修改题目排序为按display id排序
Harry-zklcdc Jul 21, 2019
fa273fb
添加看板娘api
Harry-zklcdc Aug 26, 2019
a4a49d9
fix bug
Harry-zklcdc Aug 26, 2019
d827688
fix bugs
Harry-zklcdc Aug 26, 2019
226f1da
fix bugs
Harry-zklcdc Aug 26, 2019
a7c0d8f
fix bugs
Harry-zklcdc Aug 26, 2019
ab3270e
fix bugs
Harry-zklcdc Aug 26, 2019
798776d
fix bugs
Harry-zklcdc Aug 27, 2019
9ff2324
fix bugs
Harry-zklcdc Aug 27, 2019
8720a19
fix bugs
Harry-zklcdc Aug 27, 2019
662dd60
fix bugs
Harry-zklcdc Aug 27, 2019
7e84802
fix bugs
Harry-zklcdc Sep 7, 2019
43a8e39
fix bugs
Harry-zklcdc Sep 7, 2019
970dcd5
Fix live2d's bug;Add docker images
Harry-zklcdc Sep 7, 2019
2bc5112
fix bugs
Sep 10, 2019
ed16473
增大编译时限
Harry-zklcdc Sep 30, 2019
82986de
修改密码错误返回值导致CI测试不通过问题
Harry-zklcdc Sep 30, 2019
c1224bb
fix bugs
Harry-zklcdc Sep 30, 2019
a1bd341
rm live2d plugin
Harry-zklcdc Sep 30, 2019
624fea0
Merge branch 'master' of https://github.com/Harry-zklcdc/OnlineJudge
Harry-zklcdc Sep 30, 2019
b9cf579
实现在动态获取语言编译命令
Harry-zklcdc Oct 1, 2019
cc43dc7
实现在动态获取语言编译命令
Harry-zklcdc Oct 1, 2019
1cf08f2
merge from branch 'ide'; 实现在动态获取语言编译命令
Harry-zklcdc Oct 1, 2019
7756231
修改编译和运行时间,防止导致服务器卡顿
Harry-zklcdc Oct 5, 2019
8591798
升级GCC和G++的版本
Nov 14, 2019
1bb7197
升级GCC和G++编译器
Harry-zklcdc Nov 14, 2019
0d8814d
升级GCC和G++编译器
Harry-zklcdc Nov 15, 2019
9bd3fb3
Add languages
Harry-zklcdc Nov 16, 2019
2d8a3c7
fix judge_languages
Harry-zklcdc Jan 21, 2020
62e428d
Add HSTS
Harry-zklcdc Jan 22, 2020
5721a65
update readme.md
Harry-zklcdc Jan 22, 2020
2542b00
[Add] Order by Display ID
Harry-zklcdc Apr 19, 2020
5acae1a
[Add] Sighin Function
Harry-zklcdc Apr 19, 2020
e4611f9
[Fix] Flake8 Bugs
Harry-zklcdc Apr 19, 2020
2075499
[Fix] Potential Bugs
Harry-zklcdc Apr 19, 2020
4579d18
[Fix] Set Time_Zone to Asia/Shanghai
Harry-zklcdc Apr 19, 2020
7bba8ea
[Add] Upgrade System
Harry-zklcdc Apr 20, 2020
7b0e0d5
[Fix] Problem's Experience Add Error
Harry-zklcdc Apr 20, 2020
267a069
[Fix] OI Problem Experience Add Error
Harry-zklcdc Apr 20, 2020
a6a83cf
[Fix] last_sighin_time is not default to make New User couldn't Sighin
Harry-zklcdc Apr 21, 2020
8a7a1d6
[Fix] Flake8 Error
Harry-zklcdc Apr 21, 2020
e6ea5d0
[Fix] Accept Problem Add Experience Possible Error
Harry-zklcdc Apr 23, 2020
5020349
[Fix] Change Sample picture
Harry-zklcdc Apr 29, 2020
52f4ba0
[Fix] Change Sample picture
Harry-zklcdc Apr 29, 2020
a80bcdb
[Fix] Reduce Memory Usage
Harry-zklcdc May 2, 2020
464ed5d
Merge branch 'master' of https://github.com/Harry-zklcdc/OnlineJudge
Harry-zklcdc May 2, 2020
f193c5c
[Add] Release Note
Harry-zklcdc May 2, 2020
77dcfe4
[Fix] Modify the Upgrade URL
Harry-zklcdc May 2, 2020
faffd7f
[Add] Release Note
Harry-zklcdc May 2, 2020
ad43ae7
[Fix] Release Note
Harry-zklcdc May 3, 2020
e696e87
[Fix] Release Note
Harry-zklcdc May 3, 2020
a8d7416
[Fix] Release Note
Harry-zklcdc May 3, 2020
18a024b
[Fix] Release Note
Harry-zklcdc May 3, 2020
2c09460
[Add] Release Note
Harry-zklcdc May 3, 2020
ef19b30
[Add] Release Note
Harry-zklcdc May 3, 2020
ab63ed4
Merge remote-tracking branch 'upstream/master'
Harry-zklcdc May 6, 2020
73475e7
[Fix] Expand Compile Time Limit
Harry-zklcdc May 6, 2020
4462910
[Add] Release Note
Harry-zklcdc May 6, 2020
1249bb4
Merge branch 'master' of https://github.com/QingdaoU/OnlineJudge into…
Harry-zklcdc Jul 8, 2020
d0a5c53
Merge branch 'QingdaoU-master'
Harry-zklcdc Jul 8, 2020
6f6ea3c
[Fix] Format
Harry-zklcdc Jul 8, 2020
eff19aa
[Fix] languages.py
Harry-zklcdc Jul 16, 2020
020de76
Merge remote-tracking branch 'upstream/master'
Harry-zklcdc Jul 16, 2020
7676ed9
[Fix] Language information
Harry-zklcdc Jul 16, 2020
9c58047
[Upgrade] data.json
Harry-zklcdc Jul 16, 2020
6d09da3
[Add] Forum
Harry-zklcdc Jul 19, 2020
e825a16
[Fix] Format Problem
Harry-zklcdc Jul 19, 2020
2ccd75f
[Fix] Reduce time complexity
Harry-zklcdc Jul 20, 2020
ff6bf78
[Del] Delete unnecessary Serializer
Harry-zklcdc Jul 20, 2020
e28a522
[Fix] Define Floor code logic to Reduce Time/Space complexity
Harry-zklcdc Jul 20, 2020
65ba399
[Fix] ForumDelete
Harry-zklcdc Jul 30, 2020
60e8910
[Add] ForumPost Top/Light/Nice
Harry-zklcdc Jul 31, 2020
17530c4
[Remove] ForumReply Useless Model
Harry-zklcdc Jul 31, 2020
8f15bc8
[Add] Forum Reply Delete
Harry-zklcdc Jul 31, 2020
eac6844
[Fix] Sync Delete Reply when delete Post
Harry-zklcdc Jul 31, 2020
dd071bb
[Add] Forum Post/Reply Limit per min
Harry-zklcdc Jul 31, 2020
d707ab2
[Remove] ForumPost Useless Key
Harry-zklcdc Aug 1, 2020
c6f9fcd
[Add] Forum Sort Information
Harry-zklcdc Aug 1, 2020
7d5bbdf
[Add] Forum Post/Reply Permission
Harry-zklcdc Aug 1, 2020
839929a
[Fix] Conf Test Error
Harry-zklcdc Aug 1, 2020
370bc77
[Add] IDE tasks throttling
Harry-zklcdc Aug 1, 2020
ecb62c2
[Add] Forum Reply user'grade
Harry-zklcdc Aug 2, 2020
9df3237
[Fix] SuperAdmin decide
Harry-zklcdc Aug 2, 2020
bae5528
[Add] Custom User Title/Color
Harry-zklcdc Aug 2, 2020
cd3c299
[Add] Experience Rank
Harry-zklcdc Aug 2, 2020
a576dc7
[Add] Import real_name when Import Users
Harry-zklcdc Aug 2, 2020
c137e0b
[Fix] Test Error
Harry-zklcdc Aug 2, 2020
07bf2e2
[Fix] Contest Rank User's Title
Harry-zklcdc Aug 2, 2020
0fac47b
[Fix] Forum Reply return Error
Harry-zklcdc Aug 2, 2020
5e42af2
[Update] data.json
Harry-zklcdc Aug 2, 2020
2434ed4
[Fix] Remove Superadmin Post/Reply throttling && Fix Post Problem
Harry-zklcdc Aug 3, 2020
cfed97f
[Add] Send Email when Reply
Harry-zklcdc Aug 4, 2020
79b72e8
[Update] data.json
Harry-zklcdc Aug 4, 2020
236ae72
[Fix] Submission in Contest don't have User Title
Harry-zklcdc Aug 4, 2020
9891670
[Fix] Reply Email Error address
Harry-zklcdc Aug 4, 2020
7864fd4
[Fix] Username don't match
Harry-zklcdc Aug 7, 2020
a0fee49
[Opt] Optimize query performance
Harry-zklcdc Aug 7, 2020
b18f2f8
Bump urllib3 from 1.24.1 to 1.26.5 in /deploy
dependabot[bot] Jun 2, 2021
5dccd3e
Bump djangorestframework from 3.8.2 to 3.11.2 in /deploy
dependabot[bot] Mar 19, 2021
59d8df6
Bump pillow from 5.4.1 to 8.2.0 in /deploy
dependabot[bot] Jun 8, 2021
7c43429
Bump django from 2.1.7 to 2.2.24 in /deploy
dependabot[bot] Jun 19, 2021
789b9fb
[Upgrade] Upgrade Redis Version to 6.0
Harry-zklcdc Jun 20, 2021
4c39a68
[Fix] CDN problem
Harry-zklcdc Jun 20, 2021
0a2fb56
[Fix] Depend Error
Harry-zklcdc Jun 20, 2021
0254541
Merge remote-tracking branch 'upstream/master'
Harry-zklcdc Jul 11, 2021
24cd0e4
[Upgrade] upgrade_data.json
Harry-zklcdc Jul 11, 2021
f3a0579
[Add] Pypy compile / run config
Harry-zklcdc Jul 11, 2021
7fc60f6
[Update] Upgrade_data.json
Harry-zklcdc Jul 11, 2021
7d5bc32
[Fix] CDN Problem
Harry-zklcdc Jul 11, 2021
2eb44c9
[Fix] Runtime Error
Harry-zklcdc Jul 12, 2021
3c942f4
[Add] Support Node.js and PHP
Harry-zklcdc Jul 12, 2021
f4534a5
[Fix] languages config
Harry-zklcdc Jul 12, 2021
a3a216c
[Update] Upgrade_data.json
Harry-zklcdc Jul 12, 2021
3b13d7d
[Update] Upgrade_data.json
Harry-zklcdc Jul 12, 2021
1e631e2
[Fix] CDN Problem
Harry-zklcdc Jul 12, 2021
dd2a52b
[Fix] languages config
Harry-zklcdc Jul 12, 2021
9be5ea8
[Fix] languages config
Harry-zklcdc Jul 12, 2021
18d672c
[Update] Upgrade_data.json
Harry-zklcdc Jul 18, 2021
a886e2b
[Update] Upgrade_data.json
Harry-zklcdc Aug 6, 2021
27b29b9
[Update] Upgrade_data.json
Harry-zklcdc Aug 6, 2021
186dad9
[Update] Upgrade_data.json
Harry-zklcdc Aug 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apk add --update --no-cache build-base nginx openssl curl unzip supervisor j
pip install --no-cache-dir -r /app/deploy/requirements.txt && \
apk del build-base --purge

RUN curl -L $(curl -s https://api.github.com/repos/QingdaoU/OnlineJudgeFE/releases/latest | grep /dist.zip | cut -d '"' -f 4) -o dist.zip && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

域名

RUN curl -L $(curl -s https://api.github.com/repos/Harry-zklcdc/OJ/releases/latest | grep /dist.zip | cut -d '"' -f 4) -o dist.zip && \
unzip dist.zip && \
rm dist.zip

Expand Down
41 changes: 22 additions & 19 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,38 @@
[![Python](https://img.shields.io/badge/python-3.6.2-blue.svg?style=flat-square)](https://www.python.org/downloads/release/python-362/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

整个文件 markdown 标记加号也可以吧

[![Django](https://img.shields.io/badge/django-1.11.4-blue.svg?style=flat-square)](https://www.djangoproject.com/)
[![Django Rest Framework](https://img.shields.io/badge/django_rest_framework-3.4.0-blue.svg?style=flat-square)](http://www.django-rest-framework.org/)
[![Build Status](https://travis-ci.org/QingdaoU/OnlineJudge.svg?branch=master)](https://travis-ci.org/QingdaoU/OnlineJudge)
[![Build Status](https://travis-ci.org/Harry-zklcdc/OnlineJudge.svg?branch=master)](https://travis-ci.org/Harry-zklcdc/OnlineJudge)

> #### 基于 Python 和 Vue 的在线评测系统。 [Demo](https://qduoj.com)
> #### 基于 Python 和 Vue 的在线评测系统。 [Demo](http://www.yangzheng.com.cn:84)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

域名


[English Document](README.md)

## 概览

+ 基于 Docker,真正一键部署
+ 前后端分离,模块化编程,微服务
+ ACM/OI 两种比赛模式、实时/非实时评判 任意选择
+ 丰富的可视化图表,一图胜千言
+ 支持 Template Problem,可以添加函数题甚至填空题
+ 更细致的权限划分,超级管理员和普通管理员各司其职
+ 多语言支持:`C`, `C++`, `Java`, `Python2`, `Python3`,题目可以选择使用的语言
+ Markdown & MathJax 支持
+ 比赛用户IP限制 (CIDR ranges)
- 基于 Docker,真正一键部署
- 前后端分离,模块化编程,微服务
- ACM/OI 两种比赛模式、实时/非实时评判 任意选择
- 丰富的可视化图表,一图胜千言
- 支持 Template Problem,可以添加函数题甚至填空题
- 更细致的权限划分,超级管理员和普通管理员各司其职
- 多语言支持:`C`, `C++`, `Java`, `Python2`, `Python3`,题目可以选择使用的语言
- Markdown & MathJax 支持
- 比赛用户IP限制 (CIDR ranges)
- 在线 IDE
- 自定义关于我们介绍页面
- 换肤功能
- 标准输入输出 / 文件输入输出

主要模块均已开源:

+ 后端(Django): [https://github.com/QingdaoU/OnlineJudge](https://github.com/QingdaoU/OnlineJudge)
+ 前端(Vue): [https://github.com/QingdaoU/OnlineJudgeFE](https://github.com/QingdaoU/OnlineJudgeFE)
+ 判题沙箱(Seccomp): [https://github.com/QingdaoU/Judger](https://github.com/QingdaoU/Judger)
+ 判题服务器(对Judger的封装): [https://github.com/QingdaoU/JudgeServer](https://github.com/QingdaoU/JudgeServer)
- 后端(Django): [https://github.com/Harry-zklcdc/OnlineJudge](https://github.com/Harry-zklcdc/OnlineJudge)
- 前端(Vue): [https://github.com/Harry-zklcdc/OJ](https://github.com/Harry-zklcdc/OJ)
- 判题沙箱(Seccomp): [https://github.com/Harry-zklcdc/Judger](https://github.com/Harry-zklcdc/Judger)
- 判题服务器(对Judger的封装): [https://github.com/Harry-zklcdc/JudgeServer](https://github.com/Harry-zklcdc/JudgeServe)

## 安装

请根据此进行安装: [https://github.com/QingdaoU/OnlineJudgeDeploy/tree/2.0](https://github.com/QingdaoU/OnlineJudgeDeploy/tree/2.0)
请根据此进行安装: [https://github.com/Harry-zklcdc/OnlineJudgeDeploy/tree/2.0](https://github.com/Harry-zklcdc/OnlineJudgeDeploy/tree/2.0)

## 文档

Expand Down Expand Up @@ -68,15 +72,14 @@ Rankings 中可以控制图表和菜单的显隐。

![create-contest](https://user-images.githubusercontent.com/20637881/33372514-428ab922-d539-11e7-8f68-da55dedf3ad3.png)


## 浏览器支持

Modern browsers(chrome, firefox) 和 Internet Explorer 10+.

## 特别感谢

+ 所有为本项目做出贡献的人
+ [heb1c](https://github.com/hebicheng) 同学为我们提供了很多意见和建议
- 所有为本项目做出贡献的人
- [heb1c](https://github.com/hebicheng) 同学为我们提供了很多意见和建议

如果您觉得这个项目还不错,就star一下吧 :)

Expand Down
46 changes: 26 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,40 @@
[![Python](https://img.shields.io/badge/python-3.6.2-blue.svg?style=flat-square)](https://www.python.org/downloads/release/python-362/)
[![Django](https://img.shields.io/badge/django-1.11.4-blue.svg?style=flat-square)](https://www.djangoproject.com/)
[![Django Rest Framework](https://img.shields.io/badge/django_rest_framework-3.4.0-blue.svg?style=flat-square)](http://www.django-rest-framework.org/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同 README-CN.md

[![Build Status](https://travis-ci.org/QingdaoU/OnlineJudge.svg?branch=master)](https://travis-ci.org/QingdaoU/OnlineJudge)
[![Build Status](https://travis-ci.org/Harry-zklcdc/OnlineJudge.svg?branch=master)](https://travis-ci.org/Harry-zklcdc/OnlineJudge)

> #### An onlinejudge system based on Python and Vue. [Demo](https://qduoj.com)
>
>
> #### An onlinejudge system based on Python and Vue. [Demo](http://www.yangzheng.com.cn:84)

[中文文档](README-CN.md)

## Overview

+ Based on Docker; One-click deployment
+ Separated backend and frontend; Modular programming; Micro service
+ ACM/OI rule support; realtime/non-realtime rank support
+ Amazing charting and visualization
+ Template-problem support
+ More reasonable permission control
+ Multi-language support: `C`, `C++`, `Java`, `Python2`, `Python3`
+ Markdown & MathJax support
+ Contest participants IP limit(CIDR)
- Based on Docker; One-click deployment
- Separated backend and frontend; Modular programming; Micro service
- ACM/OI rule support; realtime/non-realtime rank support
- Amazing charting and visualization
- Template-problem support
- More reasonable permission control
- Multi-language support: `C`, `C++`, `Java`, `Python2`, `Python3`
- Markdown & MathJax support
- Contest participants IP limit(CIDR)
- Online IDE
- DIY About Us Page
- Optional Theme
- Standard IO/File IO

Main modules are available below:

+ Backend(Django): [https://github.com/QingdaoU/OnlineJudge](https://github.com/QingdaoU/OnlineJudge)
+ Frontend(Vue): [https://github.com/QingdaoU/OnlineJudgeFE](https://github.com/QingdaoU/OnlineJudgeFE)
+ Judger Sandbox(Seccomp): [https://github.com/QingdaoU/Judger](https://github.com/QingdaoU/Judger)
+ JudgeServer(A wrapper for Judger): [https://github.com/QingdaoU/JudgeServer](https://github.com/QingdaoU/JudgeServer)
- Backend(Django): [https://github.com/Harry-zklcdc/OnlineJudge](https://github.com/Harry-zklcdc/OnlineJudge)
- Frontend(Vue): [https://github.com/Harry-zklcdc/OJ](https://github.com/Harry-zklcdc/OJ)
- Judger Sandbox(Seccomp): [https://github.com/Harry-zklcdc/Judger](https://github.com/Harry-zklcdc/Judger)
- JudgeServer(A wrapper for Judger): [https://github.com/Harry-zklcdc/JudgeServer](https://github.com/Harry-zklcdc/JudgeServer)

## Installation

Follow me: [https://github.com/QingdaoU/OnlineJudgeDeploy/tree/2.0](https://github.com/QingdaoU/OnlineJudgeDeploy/tree/2.0)
Follow me: [https://github.com/Harry-zklcdc/OnlineJudgeDeploy/tree/2.0](https://github.com/Harry-zklcdc/OnlineJudgeDeploy/tree/2.0)

## Documents

Expand Down Expand Up @@ -76,10 +82,10 @@ Modern browsers(chrome, firefox) and Internet Explorer 10+.

## Thanks

+ I'd appreciate a star if you find this helpful.
+ Thanks to everyone that contributes to this project.
+ Special thanks to [heb1c](https://github.com/hebicheng), who has given us a lot of suggestions.
- I'd appreciate a star if you find this helpful.
- Thanks to everyone that contributes to this project.
- Special thanks to [heb1c](https://github.com/hebicheng), who has given us a lot of suggestions.

## License

[MIT](http://opensource.org/licenses/MIT)
[MIT](http://opensource.org/licenses/MIT)**
5 changes: 5 additions & 0 deletions account/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ def get(self, request):
user = user.filter(Q(username__icontains=keyword) |
Q(userprofile__real_name__icontains=keyword) |
Q(email__icontains=keyword))

only_admin = request.GET.get("onlyadmin", None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

admin_only 好一些?

下面的筛选应该用

user.filter(Q(admin_type=AdminType.ADMIN)|Q(admin_type=AdminType.SuperAdmin))

https://github.com/QingdaoU/OnlineJudge/blob/master/account/models.py#L7

if only_admin:
user = user.filter(Q(admin_type__icontains="Admin"))

return self.success(self.paginate_data(request, user, UserAdminSerializer))

@super_admin_required
Expand Down
1 change: 1 addition & 0 deletions announcement/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ class Migration(migrations.Migration):
},
),
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多了空行


30 changes: 30 additions & 0 deletions announcement/migrations/0004_auto_20190430_2118.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2019-04-30 21:18
from __future__ import unicode_literals

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models

import utils.models


class Migration(migrations.Migration):

dependencies = [
('announcement', '0003_auto_20180501_0436'),
]

operations = [
migrations.CreateModel(
name='AboutUs',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', utils.models.RichTextField()),
('last_update_time', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'aboutus',
},
),
]
9 changes: 9 additions & 0 deletions announcement/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ class Announcement(models.Model):
class Meta:
db_table = "announcement"
ordering = ("-create_time",)


class AboutUs(models.Model):
# HTML
content = RichTextField()
last_update_time = models.DateTimeField(auto_now=True)

class Meta:
db_table = "aboutus"
18 changes: 17 additions & 1 deletion announcement/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from utils.api import serializers
from utils.api._serializers import UsernameSerializer

from .models import Announcement
from .models import Announcement, AboutUs


class CreateAnnouncementSerializer(serializers.Serializer):
Expand All @@ -23,3 +23,19 @@ class EditAnnouncementSerializer(serializers.Serializer):
title = serializers.CharField(max_length=64)
content = serializers.CharField(max_length=1024 * 1024 * 8)
visible = serializers.BooleanField()


class CreateAboutUsSerializer(serializers.Serializer):
content = serializers.CharField(max_length=1024 * 1024 * 8)


class AboutUsSerializer(serializers.ModelSerializer):

class Meta:
model = AboutUs
fields = "__all__"


class EditAboutUsSerializer(serializers.Serializer):
id = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id = 0 没用吧

content = serializers.CharField(max_length=1024 * 1024 * 8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateAboutUsSerializer EditAboutUsSerializer 其实可以合并成一个? CreateEditAboutUsSerializer

3 changes: 2 additions & 1 deletion announcement/urls/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.conf.urls import url

from ..views.admin import AnnouncementAdminAPI
from ..views.admin import AnnouncementAdminAPI, AboutUsAdminAPI

urlpatterns = [
url(r"^announcement/?$", AnnouncementAdminAPI.as_view(), name="announcement_admin_api"),
url(r"^aboutus/?$", AboutUsAdminAPI.as_view(), name="aboutus_admin_api"),
]
3 changes: 2 additions & 1 deletion announcement/urls/oj.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.conf.urls import url

from ..views.oj import AnnouncementAPI
from ..views.oj import AnnouncementAPI, AboutUsAPI

urlpatterns = [
url(r"^announcement/?$", AnnouncementAPI.as_view(), name="announcement_api"),
url(r"^aboutus/?$", AboutUsAPI.as_view(), name="aboutus_api"),
]
48 changes: 45 additions & 3 deletions announcement/views/admin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from account.decorators import super_admin_required
from utils.api import APIView, validate_serializer

from announcement.models import Announcement
from announcement.serializers import (AnnouncementSerializer, CreateAnnouncementSerializer,
EditAnnouncementSerializer)
from announcement.models import Announcement, AboutUs
from announcement.serializers import (AnnouncementSerializer, CreateAnnouncementSerializer, EditAnnouncementSerializer,
AboutUsSerializer, CreateAboutUsSerializer, EditAboutUsSerializer)


class AnnouncementAdminAPI(APIView):
Expand Down Expand Up @@ -60,3 +60,45 @@ def delete(self, request):
if request.GET.get("id"):
Announcement.objects.filter(id=request.GET["id"]).delete()
return self.success()


class AboutUsAdminAPI(APIView):
@validate_serializer(CreateAboutUsSerializer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种全局只会有一条的东西,建议放在 https://github.com/QingdaoU/OnlineJudge/blob/master/options/options.py#L95

OptionKeys OptionDefaultValue _SysOptionsMeta 三个位置各自模仿写一下就可以了,不用单独建一个表

@super_admin_required
def post(self, request):
"""
publish aboutus
"""
data = request.data
aboutus = AboutUs.objects.create(content=data["content"])
return self.success(AboutUsSerializer(aboutus).data)

@validate_serializer(EditAboutUsSerializer)
@super_admin_required
def put(self, request):
"""
edit aboutus
"""
data = request.data
try:
aboutus = AboutUs.objects.get(id=1)
except AboutUs.DoesNotExist:
return self.error("About Us does not exist")

for k, v in data.items():
setattr(aboutus, k, v)
aboutus.save()

return self.success(AboutUsSerializer(aboutus).data)

@super_admin_required
def get(self, request):
"""
get about_us list / get about_us
"""
aboutus_id = 1
try:
aboutus = AboutUs.objects.get(id=aboutus_id)
return self.success(AboutUsSerializer(aboutus).data)
except AboutUs.DoesNotExist:
return self.success(None)
13 changes: 11 additions & 2 deletions announcement/views/oj.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
from utils.api import APIView

from announcement.models import Announcement
from announcement.serializers import AnnouncementSerializer
from announcement.models import Announcement, AboutUs
from announcement.serializers import AnnouncementSerializer, AboutUsSerializer


class AnnouncementAPI(APIView):
def get(self, request):
announcements = Announcement.objects.filter(visible=True)
return self.success(self.paginate_data(request, announcements, AnnouncementSerializer))


class AboutUsAPI(APIView):
def get(self, request):
try:
aboutus = AboutUs.objects.get(id=1)
return self.success(AboutUsSerializer(aboutus).data)
except AboutUs.DoesNotExist:
return self.error("About Us does not exist")
2 changes: 1 addition & 1 deletion conf/urls/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
url(r"^judge_server/?$", JudgeServerAPI.as_view(), name="judge_server_api"),
url(r"^prune_test_case/?$", TestCasePruneAPI.as_view(), name="prune_test_case_api"),
url(r"^versions/?$", ReleaseNotesAPI.as_view(), name="get_release_notes_api"),
url(r"^dashboard_info", DashboardInfoAPI.as_view(), name="dashboard_info_api"),
url(r"^dashboard_info", DashboardInfoAPI.as_view(), name="dashboard_info_api")
]
Loading