diff --git a/axes/management/commands/axes_list_attempts.py b/axes/management/commands/axes_list_attempts.py index b9bd6df..b4ca341 100644 --- a/axes/management/commands/axes_list_attempts.py +++ b/axes/management/commands/axes_list_attempts.py @@ -8,8 +8,8 @@ class Command(BaseCommand): def handle(self, *args, **options): # pylint: disable=unused-argument for obj in AccessAttempt.objects.all(): - self.stdout.write('{ip}\t{username}\t{failures}'.format( + self.stdout.write('{ip}\t{username}\t{failures_since_start}'.format( ip=obj.ip_address, username=obj.username, - failures=obj.failures, + failures_since_start=obj.failures_since_start, )) diff --git a/axes/models.py b/axes/models.py index 33e7381..46d8097 100644 --- a/axes/models.py +++ b/axes/models.py @@ -56,12 +56,8 @@ class AccessAttempt(AccessBase): _('Failed Logins'), ) - @property - def failures(self): - return self.failures_since_start - def __str__(self): - return 'Attempted Access: %s' % self.attempt_time + return 'Attempted Access: {}'.format(self.attempt_time) class Meta: verbose_name = _('access attempt') @@ -83,7 +79,7 @@ class AccessLog(AccessBase): ) def __str__(self): - return 'Access Log for %s @ %s' % (self.username, self.attempt_time) + return 'Access Log for {} @ {}'.format(self.username, self.attempt_time) class Meta: verbose_name = _('access log') diff --git a/axes/tests/test_models.py b/axes/tests/test_models.py index 3709135..8f84353 100644 --- a/axes/tests/test_models.py +++ b/axes/tests/test_models.py @@ -20,12 +20,6 @@ class ModelsTestCase(TestCase): def test_access_attempt_str(self): self.assertIn('Access', str(self.access_attempt)) - def test_access_attempt_failures(self): - self.assertEqual( - self.access_attempt.failures, - self.failures_since_start, - ) - def test_access_log_str(self): self.assertIn('Access', str(self.access_log))