mirror of
https://github.com/DMOJ/online-judge.git
synced 2024-11-25 16:32:37 +08:00
Add tier field to judge model
This commit is contained in:
parent
8cebcedfa2
commit
795d19131d
@ -65,12 +65,12 @@ class JudgeAdmin(VersionAdmin):
|
||||
readonly_fields = ('created', 'online', 'start_time', 'ping', 'load', 'last_ip', 'runtimes', 'problems',
|
||||
'is_disabled')
|
||||
fieldsets = (
|
||||
(None, {'fields': ('name', 'auth_key', 'is_blocked', 'is_disabled')}),
|
||||
(None, {'fields': ('name', 'auth_key', 'is_blocked', 'is_disabled', 'tier')}),
|
||||
(_('Description'), {'fields': ('description',)}),
|
||||
(_('Information'), {'fields': ('created', 'online', 'last_ip', 'start_time', 'ping', 'load')}),
|
||||
(_('Capabilities'), {'fields': ('runtimes',)}),
|
||||
)
|
||||
list_display = ('name', 'online', 'is_disabled', 'start_time', 'ping', 'load', 'last_ip')
|
||||
list_display = ('name', 'online', 'is_disabled', 'tier', 'start_time', 'ping', 'load', 'last_ip')
|
||||
ordering = ['-online', 'name']
|
||||
formfield_overrides = {
|
||||
TextField: {'widget': AdminMartorWidget},
|
||||
|
19
judge/migrations/0147_judge_add_tiers.py
Normal file
19
judge/migrations/0147_judge_add_tiers.py
Normal file
@ -0,0 +1,19 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('judge', '0146_comment_revision_count_v2'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='judge',
|
||||
name='tier',
|
||||
field=models.PositiveIntegerField(
|
||||
default=1,
|
||||
help_text='The tier of this judge. Only online judges of the minimum tier will be used. This is used for high-availability.',
|
||||
verbose_name='judge tier',
|
||||
),
|
||||
),
|
||||
]
|
@ -131,6 +131,9 @@ class Judge(models.Model):
|
||||
'even if its key is correct.'))
|
||||
is_disabled = models.BooleanField(verbose_name=_('disable judge'), default=False,
|
||||
help_text=_('Whether this judge should be removed from judging queue.'))
|
||||
tier = models.PositiveIntegerField(verbose_name=_('judge tier'), default=1,
|
||||
help_text=_('The tier of this judge. Only online judges of the minimum tier '
|
||||
'will be used. This is used for high-availability.'))
|
||||
online = models.BooleanField(verbose_name=_('judge online status'), default=False)
|
||||
start_time = models.DateTimeField(verbose_name=_('judge start time'), null=True)
|
||||
ping = models.FloatField(verbose_name=_('response time'), null=True)
|
||||
|
Loading…
Reference in New Issue
Block a user