Merge branch 'master' of gitlab.prodcontest.ru:team-15/project

This commit is contained in:
ITQ
2025-03-02 01:42:12 +03:00
14 changed files with 151 additions and 34 deletions
@@ -0,0 +1,19 @@
# Generated by Django 5.1.6 on 2025-03-01 22:16
import apps.competition.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('competition', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='competition',
name='image_url',
field=models.ImageField(blank=True, null=True, upload_to=apps.competition.models.Competition.image_url_upload_to, verbose_name='изображение соревнования'),
),
]
@@ -47,9 +47,6 @@ class Competition(BaseModel):
def __str__(self):
return self.title
@property
def
class Meta:
verbose_name = "соревнование"
@@ -0,0 +1,17 @@
# Generated by Django 5.1.6 on 2025-03-01 22:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('task', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='competitiontask',
options={'verbose_name': 'задание', 'verbose_name_plural': 'задания'},
),
]
@@ -1,30 +0,0 @@
import unittest
from apps.task.tasks import analyze_data_task
class TestAnalyzeDataTask(unittest.TestCase):
def test_task_execution_basic(self):
code_str = 'print("Hello, World!")'
result_path = "stdout"
expected_bytes = b"Hello, World!\n"
result = analyze_data_task(code_str, result_path, expected_bytes)
self.assertTrue(result["success"])
self.assertTrue(result["match"])
def test_task_execution_with_files(self):
code_str = """
with open("file.txt") as f:
print(f.read())
"""
result_path = "stdout"
expected_bytes = b"some_content\n"
result = analyze_data_task(
code_str,
result_path,
expected_bytes,
input_files=[{"bind_at": "file.txt", "content": b"some_content"}],
)
print(result)
self.assertTrue(result["success"])
self.assertTrue(result["match"])
+9
View File
@@ -0,0 +1,9 @@
from django.contrib import admin
from apps.team.models import Team
@admin.register(Team)
class TeamAdmin(admin.ModelAdmin):
list_display = ("name", "owner")
search_fields = ("name", "owner", "members",)
+7
View File
@@ -0,0 +1,7 @@
from django.apps import AppConfig
class TeamConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.team'
verbose_name = "Команды"
@@ -0,0 +1,30 @@
# Generated by Django 5.1.6 on 2025-03-01 22:16
import django.db.models.deletion
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('user', '0002_alter_user_email_alter_user_password_and_more'),
]
operations = [
migrations.CreateModel(
name='Team',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=50, verbose_name='название')),
('members', models.ManyToManyField(related_name='team_members', to='user.user', verbose_name='участники')),
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.user', verbose_name='владелец')),
],
options={
'verbose_name': 'команда',
'verbose_name_plural': 'команды',
},
),
]
+19
View File
@@ -0,0 +1,19 @@
from django.db import models
from apps.core.models import BaseModel
from apps.user.models import User
class Team(BaseModel):
name = models.CharField(max_length=50, verbose_name="название")
owner = models.ForeignKey(User, on_delete=models.CASCADE,
verbose_name="владелец")
members = models.ManyToManyField(User, related_name="team_members",
verbose_name="участники")
def __str__(self):
return self.name
class Meta:
verbose_name = "команда"
verbose_name_plural = "команды"