From bb649672d070889a7211cec63eda4dc3820a3837 Mon Sep 17 00:00:00 2001 From: Phil Gyford Date: Wed, 7 Aug 2024 21:18:25 +0100 Subject: [PATCH] Fix error in field in Django 5.1 `ManyToManyRel.is_hidden()` has been removed in Django 5.1, leaving `ManyToManyRel.hidden`. This resulted in a fatal error when using django-sortedm2m in Django 5.1 where `is_hidden()` is used in `sortedm2m/fields.py`. This commit replaces that call with use of the `hidden` property. For #214 --- sortedm2m/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sortedm2m/fields.py b/sortedm2m/fields.py index d9a892a5..b7f89ef2 100644 --- a/sortedm2m/fields.py +++ b/sortedm2m/fields.py @@ -232,7 +232,7 @@ def contribute_to_class(self, cls, name, **kwargs): if rel.symmetrical and (rel.model == "self" or rel.model == cls._meta.object_name): rel.related_name = "%s_rel_+" % name - elif rel.is_hidden(): + elif rel.hidden: # If the backwards relation is disabled, replace the original # related_name with one generated from the m2m field name. Django # still uses backwards relations internally and we need to avoid