diff --git a/ninja_apikey/models.py b/ninja_apikey/models.py index 6bac925..c020ed0 100644 --- a/ninja_apikey/models.py +++ b/ninja_apikey/models.py @@ -29,4 +29,4 @@ def is_valid(self): return self.expires_at >= timezone.now() def __str__(self): - return f"{self.user.username}<{self.prefix}>" + return f"{self.user.get_username()}<{self.prefix}>" diff --git a/ninja_apikey/tests.py b/ninja_apikey/tests.py index 2045d3a..455151c 100644 --- a/ninja_apikey/tests.py +++ b/ninja_apikey/tests.py @@ -53,7 +53,7 @@ def test_apikey_check(): key.hashed_key = key_data.hashed_key key.save() assert key - assert user.username in str(key) + assert user.get_username() in str(key) assert not check_apikey(key_data.key) assert not check_apikey(key.prefix) assert not check_apikey(f"{key_data.prefix}.{get_random_string(10)}")