import os from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.contests.models import submission_statuses from oioioi.problems.models import Problem from oioioi.programs.models import TestReport check_django_app_dependencies(__name__, ['oioioi.testrun'], strict=True) submission_statuses.register('MSE', _("Outgoing message size limit exceeded")) submission_statuses.register('MCE', _("Outgoing message count limit exceeded")) class ZeusProblemData(models.Model): problem = models.OneToOneField(Problem, primary_key=True) zeus_id = models.CharField(max_length=255) zeus_problem_id = models.IntegerField(default=0) def make_custom_library_filename(instance, filename): if not instance.id: instance.save() return 'testruns/%s/%d/lib%s' % (instance.problem_instance.contest.id, instance.id, os.path.splitext(filename)[1]) class ZeusTestReport(TestReport):
from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.contests.date_registration import date_registry from oioioi.contests.models import Contest # The view imports participants.models check_django_app_dependencies(__name__, ['oioioi.participants']) @date_registry.register('start_date', name_generator=(lambda obj: _("Enable complaints"))) @date_registry.register('end_date', name_generator=(lambda obj: _("Disable complaints"))) class ComplaintsConfig(models.Model): contest = models.OneToOneField(Contest, related_name='complaints_config', on_delete=models.CASCADE) enabled = models.BooleanField(default=False, verbose_name=_("enabled")) start_date = models.DateTimeField(verbose_name=_("start date")) end_date = models.DateTimeField(blank=True, null=True, verbose_name=_("end date")) class Meta(object): verbose_name = _("complaints configuration") verbose_name_plural = _("complaints configurations")
import difflib import urllib import six.moves.urllib.parse from django.core.urlresolvers import reverse from django.core.validators import RegexValidator from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.base.utils.validators import validate_whitespaces from oioioi.contests.models import Contest from oioioi.participants.models import RegistrationModel check_django_app_dependencies(__name__, ['oioioi.participants']) T_SHIRT_SIZES = [(s, s) for s in ('S', 'M', 'L', 'XL', 'XXL')] PROVINCES = [(s, s) for s in ( u'dolnośląskie', u'kujawsko-pomorskie', u'lubelskie', u'lubuskie', u'łódzkie', u'małopolskie', u'mazowieckie', u'opolskie', u'podkarpackie', u'podlaskie', u'pomorskie',
from django.db import models from django.utils.safestring import mark_safe from django.utils.translation import get_language, get_language_from_request from django.utils.translation import ugettext_lazy as _ from mistune import Markdown from oioioi.base.utils.deps import check_django_app_dependencies check_django_app_dependencies(__name__, ['oioioi.portals']) class News(models.Model): date = models.DateTimeField(auto_now_add=True, verbose_name=_("date")) def get_content(self, request=None): if request is not None: lang = get_language_from_request(request) try: return self.versions.get(language=lang) except NewsLanguageVersion.DoesNotExist: pass try: return self.versions.get(language=get_language()) except NewsLanguageVersion.DoesNotExist: return self.versions.first() class NewsLanguageVersion(models.Model): """Represents a content of a news. News may have multiple versions - each in another language.
from django.contrib.auth.models import User from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies check_django_app_dependencies(__name__, ['oioioi.contestexcl']) class IpToUser(models.Model): """Represents mapping for automatic authorization based on IP address.""" ip_addr = models.GenericIPAddressField(unique=True, unpack_ipv4=True, verbose_name=_("IP address")) user = models.ForeignKey(User, on_delete=models.CASCADE) class Meta(object): verbose_name = _("IP autoauth mapping") verbose_name_plural = _("IP autoauth mappings") def __unicode__(self): return self.ip_addr class DnsToUser(models.Model): """Represents mapping for automatic authorization based on DNS hostname.""" dns_name = models.CharField(unique=True, max_length=255, verbose_name=_("DNS hostname")) user = models.ForeignKey(User, on_delete=models.CASCADE)
from oioioi.base.utils.deps import check_django_app_dependencies check_django_app_dependencies(__name__, ['oioioi.programs'])
from oioioi.base.utils.deps import check_django_app_dependencies check_django_app_dependencies(__name__, ['oioioi.livedata'])
import os from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.contests.models import submission_statuses from oioioi.filetracker.fields import FileField from oioioi.problems.models import Problem from oioioi.testrun.models import TestRunReport, TestRunProgramSubmission check_django_app_dependencies(__name__, ['oioioi.testrun'], strict=True) check_django_app_dependencies(__name__, ['oioioi.submitsqueue']) submission_statuses.register('MSE', _("Outgoing message size limit exceeded")) submission_statuses.register('MCE', _("Outgoing message count limit exceeded")) class ZeusProblemData(models.Model): problem = models.OneToOneField(Problem, primary_key=True) zeus_id = models.CharField(max_length=255) zeus_problem_id = models.IntegerField(default=0) class ZeusAsyncJob(models.Model): check_uid = models.IntegerField(primary_key=True) environ = models.TextField() resumed = models.BooleanField(default=False)
from django.db import models from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies check_django_app_dependencies(__name__, ['oioioi.teachers']) class Friendship(models.Model): """Represents a friendship between task creators Friends can access user uploaded problems. Friendship is one-sided. """ # "creator" created the friendship (want's their problems to be shared) creator = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_("creator"), related_name='friendships_created') # "receiver" gets access to problems of "creator" receiver = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_("receiver"), related_name='friendships_received') class Meta: unique_together = ('creator', 'receiver')
from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.contests.models import ProblemInstance from oioioi.submitsqueue.models import submission_states check_django_app_dependencies(__name__, ['oioioi.submitsqueue'], strict=True) submission_states.register('SUSPENDED', _("Suspended")) class SuspendedProblem(models.Model): problem_instance = models.OneToOneField(ProblemInstance, related_name='suspended') suspend_init_tests = models.BooleanField(default=True)
from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.contests.models import Submission check_django_app_dependencies(__name__, ['oioioi.oi']) class OISubmitExtraData(models.Model): submission = models.OneToOneField(Submission) localtime = models.DateTimeField(blank=True, null=True, verbose_name=_("local time")) siotime = models.DateTimeField(blank=True, null=True, verbose_name=_("sio time")) servertime = models.DateTimeField(blank=True, null=True, verbose_name=_("server time")) received_suspected = models.BooleanField( default=False, verbose_name=_("received suspected")) comments = models.CharField(max_length=255)
from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.contests.models import Submission check_django_app_dependencies(__name__, ['oioioi.oi']) class OISubmitExtraData(models.Model): submission = models.OneToOneField(Submission, on_delete=models.CASCADE) localtime = models.DateTimeField(blank=True, null=True, verbose_name=_("local time")) siotime = models.DateTimeField(blank=True, null=True, verbose_name=_("sio time")) servertime = models.DateTimeField(blank=True, null=True, verbose_name=_("server time")) received_suspected = models.BooleanField(default=False, verbose_name=_("received suspected")) comments = models.CharField(max_length=255)
from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.contests.models import Contest, Submission check_django_app_dependencies(__name__, ['oioioi.disqualification'], strict=True) class SubmissionsSimilarityGroup(models.Model): contest = models.ForeignKey(Contest, verbose_name=_("contest"), on_delete=models.CASCADE) comment = models.TextField(blank=True, verbose_name=_("admin comment")) class Meta(object): verbose_name = _("submissions similarity") verbose_name_plural = _("submissions similarities") class SubmissionsSimilarityEntry(models.Model): submission = models.ForeignKey(Submission, verbose_name=_("submission"), related_name='similarities', on_delete=models.CASCADE) group = models.ForeignKey(SubmissionsSimilarityGroup, verbose_name=_("group"), related_name='submissions', on_delete=models.CASCADE) guilty = models.BooleanField(default=True, verbose_name=_("guilty"))
from django.contrib.auth.models import User from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies check_django_app_dependencies(__name__, ['oioioi.contestexcl']) class IpToUser(models.Model): """Represents mapping for automatic authorization based on IP address.""" ip_addr = models.GenericIPAddressField(unique=True, unpack_ipv4=True, verbose_name=_("IP address")) user = models.ForeignKey(User, on_delete=models.CASCADE) class Meta(object): verbose_name = _("IP autoauth mapping") verbose_name_plural = _("IP autoauth mappings") def __unicode__(self): return self.ip_addr class DnsToUser(models.Model): """Represents mapping for automatic authorization based on DNS hostname.""" dns_name = models.CharField(unique=True, max_length=255, verbose_name=_("DNS hostname")) user = models.ForeignKey(User, on_delete=models.CASCADE) class Meta(object): verbose_name = _("DNS autoauth mapping")
from django.db import models from django.utils.translation import ugettext_lazy as _ from oioioi.base.utils.deps import check_django_app_dependencies from oioioi.contests.models import Submission, Contest check_django_app_dependencies(__name__, ["oioioi.disqualification"], strict=True) class SubmissionsSimilarityGroup(models.Model): contest = models.ForeignKey(Contest, verbose_name=_("contest")) comment = models.TextField(blank=True, verbose_name=_("admin comment")) class Meta(object): verbose_name = _("submissions similarity") verbose_name_plural = _("submissions similarities") class SubmissionsSimilarityEntry(models.Model): submission = models.ForeignKey(Submission, verbose_name=_("submission"), related_name="similarities") group = models.ForeignKey(SubmissionsSimilarityGroup, verbose_name=_("group"), related_name="submissions") guilty = models.BooleanField(default=True, verbose_name=_("guilty")) class Meta(object): verbose_name = _("submissions similarity entry") verbose_name_plural = _("submissions similarity entries") unique_together = (("submission", "group"),)
from django.db import models from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _, \ get_language_from_request, get_language from mistune import Markdown from oioioi.base.utils.deps import check_django_app_dependencies check_django_app_dependencies(__name__, ['oioioi.portals']) class News(models.Model): date = models.DateTimeField(auto_now_add=True, verbose_name=_("date")) def get_content(self, request=None): if request is not None: lang = get_language_from_request(request) try: return self.versions.get(language=lang) except NewsLanguageVersion.DoesNotExist: pass try: return self.versions.get(language=get_language()) except NewsLanguageVersion.DoesNotExist: return self.versions.first() class NewsLanguageVersion(models.Model): """ Represents a content of a news. News may have multiple versions - each in another language.