summaryrefslogtreecommitdiff
path: root/patchwork/views
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2020-03-03 10:46:37 +0000
committerStephen Finucane <stephen@that.guru>2020-04-26 13:45:45 +0100
commitac0e4de9f56eb90d816a320f70d87c45d702432e (patch)
treef5f2f517c730af186cb405d3b17f866c41e14d03 /patchwork/views
parent0686a736fbf6d869bd31bd135ba38080ac96de22 (diff)
downloadpatchwork-ac0e4de9f56eb90d816a320f70d87c45d702432e.tar
patchwork-ac0e4de9f56eb90d816a320f70d87c45d702432e.tar.gz
models: Merge 'Patch' and 'Submission'
Oh, the follies of youth. Time to undo the damage of 2.0.0, specifically commit 86172ccc16, which split Patch into two separate models using concrete inheritance. As noted previously, this introduced a large number of unavoidable JOINs across large tables and the performance impacts these introduce are blocking other features we want, such as improved tagging functionality. To combine these two models, we must do the following: - Update any references to the 'Patch' model to point to the 'Submission' model instead - Move everything from 'Patch' to 'Submission', including both fields and options - Delete the 'Patch' model - Rename the 'Submission' model to 'Patch' With this change, our model "hierarchy" goes from: Submission Patch PatchComment Cover CoverComment To a nice, flat: Patch PatchComment Cover CoverComment I expect this migration to be intensive, particularly for MySQL users who will see their entire tables rewritten. Unfortunately I don't see any way to resolve this in an easier manner. Signed-off-by: Stephen Finucane <stephen@that.guru>
Diffstat (limited to 'patchwork/views')
-rw-r--r--patchwork/views/__init__.py2
-rw-r--r--patchwork/views/utils.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/patchwork/views/__init__.py b/patchwork/views/__init__.py
index ad17a07..3efe90c 100644
--- a/patchwork/views/__init__.py
+++ b/patchwork/views/__init__.py
@@ -257,7 +257,7 @@ def generic_list(request, project, view, view_args=None, filter_settings=None,
context['filters'].set_status(filterclass, setting)
if patches is None:
- patches = Patch.objects.filter(patch_project=project)
+ patches = Patch.objects.filter(project=project)
# annotate with tag counts
patches = patches.with_tag_counts(project)
diff --git a/patchwork/views/utils.py b/patchwork/views/utils.py
index f02948c..2bf6525 100644
--- a/patchwork/views/utils.py
+++ b/patchwork/views/utils.py
@@ -179,8 +179,8 @@ def series_to_mbox(series):
"""
mbox = []
- for dep in series.patches.all().order_by('number'):
- mbox.append(patch_to_mbox(dep.patch))
+ for patch in series.patches.all().order_by('number'):
+ mbox.append(patch_to_mbox(patch))
return '\n'.join(mbox)