mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
Remove redundant AccessAttempt.failures property
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
This commit is contained in:
parent
c1ac9de894
commit
b120fc6fde
3 changed files with 4 additions and 14 deletions
|
|
@ -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,
|
||||
))
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue