[PATCH] models: Remove 'UserProfile.primary_project'

Stephen Finucane stephen at that.guru
Mon Oct 10 09:36:02 AEDT 2016


This field was unused and has been for a long time (pre-0.9.0).

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/forms.py                                     |  2 +-
 .../0014_remove_userprofile_primary_project.py         | 18 ++++++++++++++++++
 patchwork/models.py                                    |  1 -
 patchwork/views/user.py                                |  1 -
 4 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100644 patchwork/migrations/0014_remove_userprofile_primary_project.py

diff --git a/patchwork/forms.py b/patchwork/forms.py
index 6a9afe1..702779e 100644
--- a/patchwork/forms.py
+++ b/patchwork/forms.py
@@ -130,7 +130,7 @@ class UserProfileForm(forms.ModelForm):
 
     class Meta:
         model = UserProfile
-        fields = ['primary_project', 'items_per_page']
+        fields = ['items_per_page']
 
 
 class OptionalDelegateField(DelegateField):
diff --git a/patchwork/migrations/0014_remove_userprofile_primary_project.py b/patchwork/migrations/0014_remove_userprofile_primary_project.py
new file mode 100644
index 0000000..0f875bd
--- /dev/null
+++ b/patchwork/migrations/0014_remove_userprofile_primary_project.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('patchwork', '0013_slug_check_context'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='userprofile',
+            name='primary_project',
+        ),
+    ]
diff --git a/patchwork/models.py b/patchwork/models.py
index 217de51..f8759a5 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -119,7 +119,6 @@ class UserProfile(models.Model):
 
     # projects
 
-    primary_project = models.ForeignKey(Project, null=True, blank=True)
     maintainer_projects = models.ManyToManyField(
         Project, related_name='maintainer_project', blank=True)
 
diff --git a/patchwork/views/user.py b/patchwork/views/user.py
index 691a4f9..f76a05f 100644
--- a/patchwork/views/user.py
+++ b/patchwork/views/user.py
@@ -111,7 +111,6 @@ def profile(request):
 
     # TODO(stephenfin): Add a related_name for User->Bundle
     context = {
-        'project': request.user.profile.primary_project,
         'bundles': Bundle.objects.filter(owner=request.user),
         'profileform': form,
     }
-- 
2.7.4



More information about the Patchwork mailing list