]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
models: Use 'base_manager_name'
authorStephen Finucane <stephen@that.guru>
Thu, 18 May 2017 20:17:41 +0000 (21:17 +0100)
committerStephen Finucane <stephen@that.guru>
Thu, 18 May 2017 20:17:41 +0000 (21:17 +0100)
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@that.guru>
patchwork/models.py

index 7ca64abffa1ca1ea81cd9b04d0e14be2bca6f96f..725d0b0bf3677bb604bb5a73e0701965e6d4b090 100644 (file)
@@ -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):