Skip to content

Commit

Permalink
Merge branch 'jin_dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
soobinjeon authored and kairos0 committed Aug 31, 2021
2 parents 3af7c38 + 0efc9c8 commit 9568c0a
Show file tree
Hide file tree
Showing 21 changed files with 615 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
migrations/*
# Translations
*.mo
# Mr Developer
Expand Down
72 changes: 72 additions & 0 deletions account/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Generated by Django 2.2.16 on 2020-09-21 15:30

import account.models
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('username', models.TextField(unique=True)),
('realname', models.TextField(null=True)),
('email', models.TextField(null=True)),
('create_time', models.DateTimeField(auto_now_add=True, null=True)),
('schoolssn', models.IntegerField(default=0)),
('admin_type', models.TextField(default='Regular User')),
('problem_permission', models.TextField(default='None')),
('reset_password_token', models.TextField(null=True)),
('reset_password_token_expire_time', models.DateTimeField(null=True)),
('auth_token', models.TextField(null=True)),
('two_factor_auth', models.BooleanField(default=False)),
('tfa_token', models.TextField(null=True)),
('session_keys', django.contrib.postgres.fields.jsonb.JSONField(default=list)),
('open_api', models.BooleanField(default=False)),
('open_api_appkey', models.TextField(null=True)),
('is_disabled', models.BooleanField(default=False)),
('is_allowed', models.BooleanField(default=False)),
],
options={
'db_table': 'user',
},
managers=[
('objects', account.models.UserManager()),
],
),
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('acm_problems_status', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('oi_problems_status', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('real_name', models.TextField(null=True)),
('avatar', models.TextField(default='/public/avatar/default.png')),
('blog', models.URLField(null=True)),
('mood', models.TextField(null=True)),
('github', models.TextField(null=True)),
('school', models.TextField(null=True)),
('major', models.TextField(null=True)),
('language', models.TextField(null=True)),
('accepted_number', models.IntegerField(default=0)),
('total_score', models.BigIntegerField(default=0)),
('submission_number', models.IntegerField(default=0)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'user_profile',
},
),
]
1 change: 1 addition & 0 deletions account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def is_super_admin(self):
return self.admin_type == AdminType.SUPER_ADMIN

def is_admin_role(self):
print(self.admin_type)
return self.admin_type in [AdminType.ADMIN, AdminType.SUPER_ADMIN, AdminType.TA_ADMIN]

def can_mgmt_all_problem(self):
Expand Down
34 changes: 34 additions & 0 deletions announcement/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 2.2.16 on 2020-09-21 15:30

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


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Announcement',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.TextField()),
('content', utils.models.RichTextField()),
('create_time', models.DateTimeField(auto_now_add=True)),
('last_update_time', models.DateTimeField(auto_now=True)),
('visible', models.BooleanField(default=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'announcement',
'ordering': ('-create_time',),
},
),
]
34 changes: 34 additions & 0 deletions conf/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 2.2.16 on 2020-09-21 15:30

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='JudgeServer',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('hostname', models.TextField()),
('ip', models.TextField(null=True)),
('judger_version', models.TextField()),
('cpu_core', models.IntegerField()),
('memory_usage', models.FloatField()),
('cpu_usage', models.FloatField()),
('last_heartbeat', models.DateTimeField()),
('create_time', models.DateTimeField(auto_now_add=True)),
('task_number', models.IntegerField(default=0)),
('service_url', models.TextField(null=True)),
('is_disabled', models.BooleanField(default=False)),
],
options={
'db_table': 'judge_server',
},
),
]
91 changes: 91 additions & 0 deletions contest/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Generated by Django 2.2.16 on 2020-09-21 15:30

from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import utils.models


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('lecture', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='Contest',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.TextField()),
('description', utils.models.RichTextField()),
('real_time_rank', models.BooleanField()),
('password', models.TextField(null=True)),
('lecture_contest_type', models.TextField(default='실습')),
('rule_type', models.TextField()),
('start_time', models.DateTimeField()),
('end_time', models.DateTimeField()),
('create_time', models.DateTimeField(auto_now_add=True)),
('last_update_time', models.DateTimeField(auto_now=True)),
('visible', models.BooleanField(default=True)),
('allowed_ip_ranges', django.contrib.postgres.fields.jsonb.JSONField(default=list)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('lecture', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='lecture.Lecture')),
],
options={
'db_table': 'contest',
'ordering': ('-start_time',),
},
),
migrations.CreateModel(
name='ContestAnnouncement',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.TextField()),
('content', utils.models.RichTextField()),
('visible', models.BooleanField(default=True)),
('create_time', models.DateTimeField(auto_now_add=True)),
('contest', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contest.Contest')),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'contest_announcement',
'ordering': ('-create_time',),
},
),
migrations.CreateModel(
name='OIContestRank',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('submission_number', models.IntegerField(default=0)),
('total_score', models.IntegerField(default=0)),
('submission_info', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('contest', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contest.Contest')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'oi_contest_rank',
'unique_together': {('user', 'contest')},
},
),
migrations.CreateModel(
name='ACMContestRank',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('submission_number', models.IntegerField(default=0)),
('accepted_number', models.IntegerField(default=0)),
('total_time', models.IntegerField(default=0)),
('submission_info', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('contest', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contest.Contest')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'acm_contest_rank',
'unique_together': {('user', 'contest')},
},
),
]
18 changes: 18 additions & 0 deletions contest/migrations/0002_contest_private.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.16 on 2020-09-22 15:35

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('contest', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='contest',
name='private',
field=models.BooleanField(default=False),
),
]
2 changes: 1 addition & 1 deletion contest/views/oj.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get(self, request):
#print("Lecture allow : ", lecsign[0].isallow)
contest.visible = True
else:
if request.user.is_super_admin() or request.user.is_semi_admin(): # 문제 접근을 위한 visible 값 수정
if request.user.is_admin_role(): # 문제 접근을 위한 visible 값 수정
contest.visible = True
else:
contest.visible = False
Expand Down
Empty file added data/test_case/.gitkeep
Empty file.
64 changes: 64 additions & 0 deletions lecture/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Generated by Django 2.2.16 on 2020-09-21 15:30

from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import utils.models


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Lecture',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.TextField()),
('description', utils.models.RichTextField()),
('year', models.IntegerField()),
('semester', models.IntegerField()),
('status', models.BooleanField()),
('password', models.TextField()),
('isapply', models.BooleanField(default=False)),
('isallow', models.BooleanField(default=False)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'lecture',
},
),
migrations.CreateModel(
name='ta_admin_class',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('realname', models.TextField(default=None, null=True)),
('schoolssn', models.IntegerField(default=None, null=True)),
('lecture_isallow', models.BooleanField(default=False)),
('code_isallow', models.BooleanField(default=False)),
('score_isallow', models.BooleanField(default=False)),
('lecture', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lecture.Lecture')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='signup_class',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.BooleanField(default=False)),
('isallow', models.BooleanField(default=False)),
('realname', models.TextField(default=None, null=True)),
('schoolssn', models.IntegerField(default=None, null=True)),
('score', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('etc', models.TextField(null=True)),
('lecture', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lecture.Lecture')),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
20 changes: 20 additions & 0 deletions lecture/migrations/0002_signup_class_contest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 2.2.16 on 2020-09-21 16:18

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


class Migration(migrations.Migration):

dependencies = [
('contest', '0001_initial'),
('lecture', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='signup_class',
name='contest',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='contest.Contest'),
),
]
19 changes: 19 additions & 0 deletions lecture/migrations/0003_auto_20200922_0130.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.16 on 2020-09-21 16:30

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


class Migration(migrations.Migration):

dependencies = [
('lecture', '0002_signup_class_contest'),
]

operations = [
migrations.AlterField(
model_name='signup_class',
name='lecture',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='lecture.Lecture'),
),
]
Loading

0 comments on commit 9568c0a

Please sign in to comment.