Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade to Django 2.2 #1132

Merged
merged 23 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions example_project/example_project/urls.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from aimmo import urls as aimmo_urls
from django.conf.urls import include, url
from django.contrib import admin
from game import urls as game_urls
from portal import urls as portal_urls

from game import urls as game_urls

admin.autodiscover()

urlpatterns = [
url(r'^', include(portal_urls)),
url(r'^administration/', include(admin.site.urls)),
url(r'^rapidrouter/', include(game_urls)),
url(r'^aimmo/', include(aimmo_urls)),
url(r"^", include(portal_urls)),
url(r"^administration/", include((admin.site.urls[0], "admin"), namespace="admin")),
url(r"^rapidrouter/", include(game_urls)),
url(r"^aimmo/", include(aimmo_urls)),
]
2 changes: 1 addition & 1 deletion game/end_to_end_tests/base_game_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from common.tests.utils.classes import create_class_directly
from common.tests.utils.student import create_school_student_directly
from common.tests.utils.teacher import signup_teacher_directly
from django.core.urlresolvers import reverse
from django.urls import reverse

from game.models import Workspace
from portal.tests.pageObjects.portal.home_page import HomePage
Expand Down
2 changes: 1 addition & 1 deletion game/end_to_end_tests/game_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import os
import time

from django.core.urlresolvers import reverse
from django.urls import reverse
from hamcrest import assert_that, equal_to, contains_string, ends_with
from portal.tests.pageObjects.portal.base_page import BasePage
from selenium.common.exceptions import TimeoutException
Expand Down
4 changes: 2 additions & 2 deletions game/level_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def add_related_fields(levels):


def levels_shared_with(user):
if user.is_anonymous():
if user.is_anonymous:
return []

shared_levels = user.shared
Expand All @@ -78,7 +78,7 @@ def levels_shared_with(user):


def levels_owned_by(user):
if user.is_anonymous():
if user.is_anonymous:
return []

levels = user.userprofile.levels
Expand Down
155 changes: 101 additions & 54 deletions game/migrations/0001_squashed_0025_levels_ordering_pt1.py
Original file line number Diff line number Diff line change
Expand Up @@ -1713,60 +1713,70 @@ def add_episodes_1_to_6(apps, schema_editor):
)
episode6.save()

episode1.r_blocks = Block.objects.filter(
type__in=["turn_left", "turn_right", "move_forwards"]
episode1.r_blocks.set(
Block.objects.filter(type__in=["turn_left", "turn_right", "move_forwards"])
)

episode2.r_blocks = Block.objects.filter(
type__in=["turn_left", "turn_right", "move_forwards", "deliver"]
episode2.r_blocks.set(
Block.objects.filter(
type__in=["turn_left", "turn_right", "move_forwards", "deliver"]
)
)

episode3.r_blocks = Block.objects.filter(
type__in=["turn_left", "turn_right", "move_forwards", "controls_repeat"]
episode3.r_blocks.set(
Block.objects.filter(
type__in=["turn_left", "turn_right", "move_forwards", "controls_repeat"]
)
)

episode4.r_blocks = Block.objects.filter(
type__in=[
"turn_left",
"turn_right",
"move_forwards",
"controls_repeat_until",
"at_destination",
"controls_repeat",
]
episode4.r_blocks.set(
Block.objects.filter(
type__in=[
"turn_left",
"turn_right",
"move_forwards",
"controls_repeat_until",
"at_destination",
"controls_repeat",
]
)
)

episode5.r_blocks = Block.objects.filter(
type__in=[
"turn_left",
"turn_right",
"move_forwards",
"controls_repeat_until",
"at_destination",
"controls_if",
"road_exists",
"dead_end",
"controls_repeat",
"turn_around",
]
episode5.r_blocks.set(
Block.objects.filter(
type__in=[
"turn_left",
"turn_right",
"move_forwards",
"controls_repeat_until",
"at_destination",
"controls_if",
"road_exists",
"dead_end",
"controls_repeat",
"turn_around",
]
)
)

episode6.r_blocks = Block.objects.filter(
type__in=[
"turn_left",
"turn_right",
"move_forwards",
"controls_repeat_until",
"controls_if",
"road_exists",
"at_destination",
"wait",
"controls_repeat",
"dead_end",
"turn_around",
"controls_repeat_while",
"traffic_light",
]
episode6.r_blocks.set(
Block.objects.filter(
type__in=[
"turn_left",
"turn_right",
"move_forwards",
"controls_repeat_until",
"controls_if",
"road_exists",
"at_destination",
"wait",
"controls_repeat",
"dead_end",
"turn_around",
"controls_repeat_while",
"traffic_light",
]
)
)

episode1.save()
Expand Down Expand Up @@ -4946,7 +4956,12 @@ class Migration(migrations.Migration):
("url", models.CharField(max_length=500)),
("width", models.IntegerField()),
("height", models.IntegerField()),
("theme", models.ForeignKey(related_name="decor", to="game.Theme")),
(
"theme",
models.ForeignKey(
related_name="decor", to="game.Theme", on_delete=models.CASCADE
),
),
],
),
migrations.CreateModel(
Expand Down Expand Up @@ -4978,10 +4993,20 @@ class Migration(migrations.Migration):
("blocklyEnabled", models.BooleanField(default=True)),
("pythonEnabled", models.BooleanField(default=True)),
("anonymous", models.BooleanField(default=False)),
("character", models.ForeignKey(default=1, to="game.Character")),
(
"character",
models.ForeignKey(
default=1, to="game.Character", on_delete=models.CASCADE
),
),
(
"next_level",
models.ForeignKey(default=None, to="game.Level", null=True),
models.ForeignKey(
default=None,
to="game.Level",
null=True,
on_delete=models.SET_NULL,
),
),
(
"owner",
Expand All @@ -4990,6 +5015,7 @@ class Migration(migrations.Migration):
blank=True,
to="portal.UserProfile",
null=True,
on_delete=models.CASCADE,
),
),
(
Expand All @@ -5004,7 +5030,11 @@ class Migration(migrations.Migration):
(
"theme",
models.ForeignKey(
default=None, blank=True, to="game.Theme", null=True
default=None,
blank=True,
to="game.Theme",
null=True,
on_delete=models.CASCADE,
),
),
],
Expand All @@ -5031,7 +5061,12 @@ class Migration(migrations.Migration):
("r_trafficLights", models.BooleanField(default=False)),
(
"next_episode",
models.ForeignKey(default=None, to="game.Episode", null=True),
models.ForeignKey(
default=None,
to="game.Episode",
null=True,
on_delete=models.SET_NULL,
),
),
(
"r_blocks",
Expand All @@ -5041,7 +5076,10 @@ class Migration(migrations.Migration):
),
("in_development", models.BooleanField(default=False)),
("r_random_levels_enabled", models.BooleanField(default=False)),
("first_level", models.ForeignKey(to="game.Level")),
(
"first_level",
models.ForeignKey(to="game.Level", on_delete=models.SET_NULL),
),
],
),
migrations.CreateModel(
Expand All @@ -5059,7 +5097,7 @@ class Migration(migrations.Migration):
("x", models.IntegerField()),
("y", models.IntegerField()),
("decorName", models.CharField(default="tree1", max_length=100)),
("level", models.ForeignKey(to="game.Level")),
("level", models.ForeignKey(to="game.Level", on_delete=models.CASCADE)),
],
),
migrations.CreateModel(
Expand All @@ -5083,6 +5121,7 @@ class Migration(migrations.Migration):
blank=True,
to="portal.UserProfile",
null=True,
on_delete=models.CASCADE,
),
),
("python_contents", models.TextField(default="")),
Expand All @@ -5101,8 +5140,8 @@ class Migration(migrations.Migration):
),
),
("number", models.PositiveIntegerField(default=None, null=True)),
("level", models.ForeignKey(to="game.Level")),
("type", models.ForeignKey(to="game.Block")),
("level", models.ForeignKey(to="game.Level", on_delete=models.CASCADE)),
("type", models.ForeignKey(to="game.Block", on_delete=models.CASCADE)),
],
),
migrations.CreateModel(
Expand All @@ -5122,14 +5161,22 @@ class Migration(migrations.Migration):
("score", models.FloatField(default=0, null=True)),
("workspace", models.TextField(default="")),
("python_workspace", models.TextField(default="")),
("level", models.ForeignKey(related_name="attempts", to="game.Level")),
(
"level",
models.ForeignKey(
related_name="attempts",
to="game.Level",
on_delete=models.CASCADE,
),
),
(
"student",
models.ForeignKey(
related_name="attempts",
blank=True,
to="portal.Student",
null=True,
on_delete=models.CASCADE,
),
),
],
Expand Down
6 changes: 5 additions & 1 deletion game/migrations/0040_auto_20150128_2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ class Migration(migrations.Migration):
model_name="level",
name="episode",
field=models.ForeignKey(
default=None, blank=True, to="game.Episode", null=True
default=None,
blank=True,
to="game.Episode",
null=True,
on_delete=models.PROTECT,
),
preserve_default=False,
)
Expand Down
6 changes: 5 additions & 1 deletion game/migrations/0043_auto_20150615_1155.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ class Migration(migrations.Migration):
model_name="level",
name="episode",
field=models.ForeignKey(
default=None, blank=True, to="game.Episode", null=True
default=None,
blank=True,
to="game.Episode",
null=True,
on_delete=models.PROTECT,
),
),
]
1 change: 1 addition & 0 deletions game/migrations/0060_auto_20160208_2144.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Migration(migrations.Migration):
blank=True,
to="game.Theme",
null=True,
on_delete=models.CASCADE,
),
)
]
4 changes: 2 additions & 2 deletions game/migrations/0068_fix_episodes_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def update_episodes(apps, schema_editor):
episode7.save()
episode8.save()

episode7.level_set = episode7_levels
episode8.level_set = episode8_levels
episode7.level_set.set(episode7_levels)
episode8.level_set.set(episode8_levels)

episode7.save()
episode8.save()
Expand Down
Loading