Skip to content

Commit

Permalink
Merge pull request #599 from znick/django_2.0.13
Browse files Browse the repository at this point in the history
Update to Django 2.0.13
  • Loading branch information
znick authored Apr 7, 2024
2 parents 02a7017 + 17e1003 commit 46bdb41
Show file tree
Hide file tree
Showing 55 changed files with 651 additions and 473 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/anytask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
pip install pip>=9.0.1
pip install --upgrade flake8 'setuptools-scm==5.0.2'
pip install -r requirements_local.txt
sudo apt-get install p7zip-full tar xz-utils bzip2 gzip
sudo apt-get install -y p7zip-full tar xz-utils bzip2 gzip gettext
- name: Lint with flake8
run: |
cd anytask
Expand All @@ -43,4 +43,5 @@ jobs:
- name: Run django tests
run: |
cd anytask
python manage.py compilemessages
python manage.py test
2 changes: 1 addition & 1 deletion anytask/admission/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Migration(migrations.Migration):
('old_activation_key', models.CharField(max_length=40, null=True, blank=True)),
('is_updating', models.BooleanField(default=False)),
('user_info', models.TextField(null=True, blank=True)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)),
],
options={
},
Expand Down
2 changes: 1 addition & 1 deletion anytask/admission/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def decline_user(self, activation_key):


class AdmissionRegistrationProfile(models.Model):
user = models.ForeignKey(User, unique=False, null=False, blank=False)
user = models.ForeignKey(User, unique=False, null=False, blank=False, on_delete=models.DO_NOTHING)
activation_key = models.CharField(max_length=40, null=True, blank=True)
old_activation_key = models.CharField(max_length=40, null=True, blank=True)
is_updating = models.BooleanField(default=False)
Expand Down
2 changes: 1 addition & 1 deletion anytask/admission/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.test import TestCase
from mock import patch

from django.core.urlresolvers import reverse
from django.urls import reverse
from django.conf import settings

from users.model_user_status import UserStatus
Expand Down
2 changes: 1 addition & 1 deletion anytask/anycontest/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Migration(migrations.Migration):
('create_time', models.DateTimeField(auto_now_add=True)),
('update_time', models.DateTimeField(auto_now=True)),
('sended_notify', models.BooleanField(default=False)),
('author', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
('author', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)),
],
options={
},
Expand Down
4 changes: 2 additions & 2 deletions anytask/anycontest/migrations/0002_auto_20200328_1939.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='contestsubmission',
name='file',
field=models.ForeignKey(to='issues.File'),
field=models.ForeignKey(to='issues.File', on_delete=models.DO_NOTHING),
preserve_default=True,
),
migrations.AddField(
model_name='contestsubmission',
name='issue',
field=models.ForeignKey(to='issues.Issue'),
field=models.ForeignKey(to='issues.Issue', on_delete=models.DO_NOTHING),
preserve_default=True,
),
]
6 changes: 3 additions & 3 deletions anytask/anycontest/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class ContestSubmissionWaiting(Exception):


class ContestSubmission(models.Model):
issue = models.ForeignKey('issues.Issue', db_index=True, null=False, blank=False)
author = models.ForeignKey(User, null=False, blank=False)
file = models.ForeignKey('issues.File', null=False, blank=False)
issue = models.ForeignKey('issues.Issue', db_index=True, null=False, blank=False, on_delete=models.DO_NOTHING)
author = models.ForeignKey(User, null=False, blank=False, on_delete=models.DO_NOTHING)
file = models.ForeignKey('issues.File', null=False, blank=False, on_delete=models.DO_NOTHING)

run_id = models.CharField(max_length=191, blank=True)
compiler_id = models.CharField(max_length=191, blank=True)
Expand Down
2 changes: 1 addition & 1 deletion anytask/anycontest/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def setUp(self):
self.group = Group.objects.create(name='name_groups', year=self.year)
self.course = Course.objects.create(name='course_name',
year=self.year)
self.course.groups = [self.group]
self.course.groups.set([self.group])
self.course.save()

self.task = Task.objects.create(title='task',
Expand Down
17 changes: 9 additions & 8 deletions anytask/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.urls import reverse
from django.test import TestCase, override_settings

from courses.models import Course
from issues.model_issue_status import IssueStatus
Expand All @@ -18,6 +18,7 @@
import api.views


@override_settings(LANGUAGE_CODE='en-EN', LANGUAGES=(('en', 'English'),))
class ApiTest(TestCase):
maxDiff = None

Expand Down Expand Up @@ -63,15 +64,15 @@ def setUp(self):

self.group = Group.objects.create(name='group_name',
year=self.year)
self.group.students = [self.student]
self.group.students.set([self.student])
self.group.save()

self.course = Course.objects.create(name='course_name',
year=self.year)
self.course.groups = [self.group]
self.course.teachers = [self.teacher]
self.course.issue_fields = IssueField.objects.exclude(id=10).exclude(id=11).exclude(id=12)
self.course.issue_status_system.statuses = IssueStatus.objects.all()
self.course.groups.set([self.group])
self.course.teachers.set([self.teacher])
self.course.issue_fields.set(IssueField.objects.exclude(id=10).exclude(id=11).exclude(id=12))
self.course.issue_status_system.statuses.set(IssueStatus.objects.all())
self.course.save()

self.task1 = Task.objects.create(title='task_title1',
Expand Down Expand Up @@ -492,7 +493,7 @@ def test_post_issue__status(self, status=None):
},
{
'files': [],
'message': 'status_izmenen'
'message': 'Status updated:'
' \u0417\u0430\u0447\u0442\u0435\u043d\u043e \u043f\u043e\u0441\u043b\u0435'
' \u0434\u0435\u0434\u043b\u0430\u0439\u043d\u0430',
'id': 2,
Expand Down
5 changes: 2 additions & 3 deletions anytask/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json

from django.conf import settings
from django.contrib.auth import authenticate, login
from django.contrib.auth import authenticate
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseBadRequest, HttpResponseNotFound
from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt
Expand Down Expand Up @@ -38,11 +38,10 @@ def check_auth(request, *args, **kwargs):
return get_401_response()

username, password = base64.b64decode(auth_str_parts[1].encode('utf8')).decode('utf8').split(":", 1)
user = authenticate(username=username, password=password)
user = authenticate(request=request, username=username, password=password)
if user is None or not user.is_active:
return get_401_response()

login(request, user)
request.user = user
return view(request, *args, **kwargs)

Expand Down
18 changes: 9 additions & 9 deletions anytask/courses/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class Migration(migrations.Migration):
name='DefaultTeacher',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('course', models.ForeignKey(to='courses.Course')),
('group', models.ForeignKey(blank=True, to='groups.Group', null=True)),
('teacher', models.ForeignKey(to=settings.AUTH_USER_MODEL, blank=True, null=True, db_index=False)),
('course', models.ForeignKey(to='courses.Course', on_delete=models.DO_NOTHING)),
('group', models.ForeignKey(blank=True, to='groups.Group', null=True, on_delete=models.DO_NOTHING)),
('teacher', models.ForeignKey(to=settings.AUTH_USER_MODEL, blank=True, null=True, db_index=False, on_delete=models.DO_NOTHING)),
],
options={
},
Expand Down Expand Up @@ -97,10 +97,10 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('update_time', models.DateTimeField(default=django.utils.timezone.now, auto_now=True)),
('course', models.ForeignKey(to='courses.Course', db_index=False)),
('mark', models.ForeignKey(to='courses.MarkField', blank=True, null=True, db_index=False)),
('student', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
('teacher', models.ForeignKey(related_name=b'teacher_change_mark', blank=True, to=settings.AUTH_USER_MODEL, null=True, db_index=False)),
('course', models.ForeignKey(to='courses.Course', db_index=False, on_delete=models.DO_NOTHING)),
('mark', models.ForeignKey(to='courses.MarkField', blank=True, null=True, db_index=False, on_delete=models.DO_NOTHING)),
('student', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)),
('teacher', models.ForeignKey(related_name='teacher_change_mark', blank=True, to=settings.AUTH_USER_MODEL, null=True, db_index=False, on_delete=models.DO_NOTHING)),
],
options={
},
Expand All @@ -123,13 +123,13 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='course',
name='filename_extensions',
field=models.ManyToManyField(related_name=b'filename_extensions_set', null=True, to='courses.FilenameExtension', blank=True),
field=models.ManyToManyField(related_name='filename_extensions_set', null=True, to='courses.FilenameExtension', blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='course',
name='group_with_extern',
field=models.ForeignKey(related_name=b'course_with_extern', blank=True, to='groups.Group', null=True, db_index=False),
field=models.ForeignKey(related_name='course_with_extern', blank=True, to='groups.Group', null=True, db_index=False, on_delete=models.DO_NOTHING),
preserve_default=True,
),
migrations.AddField(
Expand Down
8 changes: 4 additions & 4 deletions anytask/courses/migrations/0002_auto_20200328_1939.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='course',
name='issue_status_system',
field=models.ForeignKey(default=1, to='issues.IssueStatusSystem', db_index=False),
field=models.ForeignKey(default=1, to='issues.IssueStatusSystem', db_index=False, on_delete=models.DO_NOTHING),
preserve_default=True,
),
migrations.AddField(
model_name='course',
name='mark_system',
field=models.ForeignKey(to='courses.CourseMarkSystem', blank=True, null=True, db_index=False),
field=models.ForeignKey(to='courses.CourseMarkSystem', blank=True, null=True, db_index=False, on_delete=models.DO_NOTHING),
preserve_default=True,
),
migrations.AddField(
model_name='course',
name='teachers',
field=models.ManyToManyField(related_name=b'course_teachers_set', null=True, to=settings.AUTH_USER_MODEL, blank=True),
field=models.ManyToManyField(related_name='course_teachers_set', null=True, to=settings.AUTH_USER_MODEL, blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='course',
name='year',
field=models.ForeignKey(default=2020, to='years.Year'),
field=models.ForeignKey(default=2020, to='years.Year', on_delete=models.DO_NOTHING),
preserve_default=True,
),
]
1 change: 1 addition & 0 deletions anytask/courses/migrations/0006_auto_20210319_2321.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


class Migration(migrations.Migration):
atomic = False

dependencies = [
('courses', '0005_auto_20210319_2320'),
Expand Down
Loading

0 comments on commit 46bdb41

Please sign in to comment.