From 11ba5a5d35e51c839c9adb1ab19862e9affe99d2 Mon Sep 17 00:00:00 2001 From: Domenico Nappo Date: Thu, 27 Nov 2025 16:12:54 +0100 Subject: [PATCH] Use settings.AUTH_USER_MODEL string instead of get_user_model() to avoid possible circular imports in projects customizing django User model --- drf_hooks/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drf_hooks/models.py b/drf_hooks/models.py index 2a98c45..c260729 100644 --- a/drf_hooks/models.py +++ b/drf_hooks/models.py @@ -79,7 +79,9 @@ class AbstractHook(models.Model): created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) - user = models.ForeignKey(get_user_model(), related_name="%(class)ss", on_delete=models.CASCADE) + user = models.ForeignKey( + settings.AUTH_USER_MODEL, related_name="%(class)ss", on_delete=models.CASCADE + ) event = models.CharField("Event", max_length=64, db_index=True) target = models.URLField("Target URL", max_length=255) headers = models.JSONField(default=get_default_headers)