[PATCH 05/19] models: Use 'base_manager_name'

Stephen Finucane stephen at that.guru
Thu May 11 05:45:14 AEST 2017


This raises warnings in Django 1.10 and will be required in Django 1.11.

We also set 'silence_use_for_related_fields_deprecation' to allow us to
retain the current behavior on versions of Django < 1.10.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/models.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/patchwork/models.py b/patchwork/models.py
index 7ca64ab..725d0b0 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -270,6 +270,9 @@ class PatchQuerySet(models.query.QuerySet):
 
 class PatchManager(models.Manager):
     use_for_related_fields = True
+    # NOTE(stephenfin): This is necessary to silence a warning with Django >=
+    # 1.10. Remove when 1.10 is the minimum supported version.
+    silence_use_for_related_fields_deprecation = True
 
     def get_queryset(self):
         return PatchQuerySet(self.model, using=self.db)
@@ -537,6 +540,7 @@ class Patch(SeriesMixin, Submission):
 
     class Meta:
         verbose_name_plural = 'Patches'
+        base_manager_name = 'objects'
 
 
 class Comment(EmailMixin, models.Model):
-- 
2.9.3



More information about the Patchwork mailing list