summaryrefslogtreecommitdiff
path: root/patchwork/forms.py
diff options
context:
space:
mode:
authorStephen Finucane <stephen.finucane@intel.com>2016-03-25 17:29:29 +0000
committerStephen Finucane <stephen.finucane@intel.com>2016-04-01 15:51:54 +0100
commit86172ccc161b44d68fcbc734f642644c8e1be84a (patch)
tree482923c6321068b1dfe5637970d359e25c7a0081 /patchwork/forms.py
parent6702a0c92b161ba8520857f1259faa83488c7100 (diff)
downloadpatchwork-86172ccc161b44d68fcbc734f642644c8e1be84a.tar
patchwork-86172ccc161b44d68fcbc734f642644c8e1be84a.tar.gz
models: Split Patch into two models
There are a lot of similarities between cover letters and patches: so many, in fact, that it would be helpful to occasionally treat them as the same thing. Achieve this by extracting out the fields that would be shared between a Patch and a hypothetical cover letter into a "sub model". This allows us to do cool stuff like assigning comments to both patches and cover letters or listing both patches and cover letters on the main screen in a natural way. The migrations for this are really the only complicated part. There are three, broken up into schema and data migrations per Django customs, and they works as follows: * Rename the 'Patch' model to 'Submission', then create a subclass called 'Patch' that includes duplicates of the patch-specific fields of Submission (with changed names to prevent conflicts). Rename non-patch specific references to the renamed 'Submission' model as necessary. * Duplicate the contents of the patch-specific fields from 'Submission' to 'Patch' * Remove the patch-specific fields from 'Submission', renaming the 'Patch' model to take their place. Update the patch-specific references to point the new 'Patch' model, rather than 'Submission'. This comes at the cost of an additional JOIN per item on the main screen, but this seems a small price to pay for the additional functionality gained. To minimise this, however, caching will be added. Signed-off-by: Stephen Finucane <stephen.finucane@intel.com> Signed-off-by: Andy Doan <andy.doan@linaro.org>
Diffstat (limited to 'patchwork/forms.py')
-rw-r--r--patchwork/forms.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/patchwork/forms.py b/patchwork/forms.py
index 628761b..3f876b7 100644
--- a/patchwork/forms.py
+++ b/patchwork/forms.py
@@ -122,7 +122,7 @@ class UserProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
- fields = ['primary_project', 'patches_per_page']
+ fields = ['primary_project', 'items_per_page']
class OptionalDelegateField(DelegateField):