-
Notifications
You must be signed in to change notification settings - Fork 16
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
[7776] django upgrade to 4.2 (LTS) #1504
Changes from all commits
ffa5c0e
289ac0c
98fce3c
738623d
3434eec
af1392c
dfd5391
8bb42e3
ec5c807
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2 on 2023-11-27 12:54 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("a4actions", "0008_set_action_obj_comment_creator"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameIndex( | ||
model_name="action", | ||
new_name="a4actions_a_obj_con_ee317e_idx", | ||
old_fields=("obj_content_type", "obj_object_id"), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2 on 2023-11-27 12:54 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("a4comments", "0013_set_project"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameIndex( | ||
model_name="comment", | ||
new_name="a4comments__content_ff606b_idx", | ||
old_fields=("content_type", "object_pk"), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.2 on 2023-11-29 12:49 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("a4modules", "0008_alter_module_blueprint_type"), | ||
("a4maps", "0002_change_help_text"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="areasettings", | ||
name="module", | ||
field=models.OneToOneField( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="%(class)s_settings", | ||
to="a4modules.module", | ||
), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2 on 2023-11-29 12:49 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("a4modules", "0007_verbose_name_created_modified"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="module", | ||
name="blueprint_type", | ||
field=models.CharField(blank=True, max_length=255), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,6 @@ | |
from adhocracy4.models import base | ||
from adhocracy4.projects import models as project_models | ||
|
||
from .fields import BlueprintTypeField | ||
|
||
|
||
class ModulesQuerySet(models.QuerySet): | ||
def annotate_module_start(self): | ||
|
@@ -95,7 +93,7 @@ class Module(models.Model): | |
|
||
objects = ModulesQuerySet.as_manager() | ||
|
||
blueprint_type = BlueprintTypeField( | ||
blueprint_type = models.CharField( | ||
max_length=255, | ||
blank=True, | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then we delete the fields.py with the custom BlueprintType? |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 4.2 on 2023-11-29 13:18 | ||
|
||
import adhocracy4.projects.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("a4projects", "0041_ckeditor5_iframes"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Topic", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("code", models.CharField(blank=True, max_length=10)), | ||
("name", models.CharField(max_length=120, verbose_name="Topic")), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name="project", | ||
name="m2mtopics", | ||
field=models.ManyToManyField(to="a4projects.topic"), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Generated by Django 4.2 on 2023-11-29 13:20 | ||
|
||
from django.db import migrations | ||
from django.conf import settings | ||
|
||
|
||
def add_topics_to_m2m_table(apps, schema_editor): | ||
if hasattr(settings, "A4_PROJECT_TOPICS"): | ||
topicsenum = settings.A4_PROJECT_TOPICS | ||
project = apps.get_model("a4projects", "Project") | ||
for project in project.objects.all(): | ||
for topic_code in project.topics: | ||
project.m2mtopics.create( | ||
code=topic_code, | ||
name=[item[1] for item in topicsenum if item[0] == topic_code][0], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. topicsenum -> topicenum |
||
) | ||
else: | ||
pass | ||
|
||
|
||
def reverse_func(apps, schema_editor): | ||
if hasattr(settings, "A4_PROJECT_TOPICS"): | ||
project = apps.get_model("a4projects", "Project") | ||
for project in project.objects.all(): | ||
for topic in project.m2mtopics.all(): | ||
project.m2mtopics.remove(topic) | ||
else: | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("a4projects", "0042_topic_alter_project_topics_project_m2mtopics"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(add_topics_to_m2m_table, reverse_func), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure why this was needed so I removed it, I think we should point out to testers to verify everything still works as intended with the icons