Allow to create group and its contest on UI

This commit is contained in:
cuom1999 2022-09-15 02:05:02 -05:00
parent 196e2a9bb0
commit 67ef6b9111
28 changed files with 1029 additions and 556 deletions

View file

@ -2,3 +2,4 @@ from judge.widgets.checkbox import CheckboxSelectMultipleWithSelectAll
from judge.widgets.mixins import CompressorWidgetMixin
from judge.widgets.pagedown import *
from judge.widgets.select2 import *
from judge.widgets.datetime import *

24
judge/widgets/datetime.py Normal file
View file

@ -0,0 +1,24 @@
from django import forms
class DateTimePickerWidget(forms.DateTimeInput):
template_name = "widgets/datetimepicker.html"
def get_context(self, name, value, attrs):
datetimepicker_id = "datetimepicker_{name}".format(name=name)
if attrs is None:
attrs = dict()
attrs["data-target"] = "#{id}".format(id=datetimepicker_id)
attrs["class"] = "form-control datetimepicker-input"
context = super().get_context(name, value, attrs)
context["widget"]["datetimepicker_id"] = datetimepicker_id
return context
@property
def media(self):
css_url = "https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.min.css"
js_url = "https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.min.js"
return forms.Media(
js=[js_url],
css={"screen": [css_url]},
)

View file

@ -45,6 +45,7 @@ from django.conf import settings
from django.core import signing
from django.forms.models import ModelChoiceIterator
from django.urls import reverse_lazy
from django.utils.http import urlencode
DEFAULT_SELECT2_JS = "//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"
DEFAULT_SELECT2_CSS = (