Merge pull request #17 from marcusmartins/package_improvements

Support django 1.6 and django 1.7
This commit is contained in:
Ken Cochrane 2015-01-05 18:06:31 -08:00
commit b8bd4bc4c6
5 changed files with 16 additions and 9 deletions

View file

@ -8,8 +8,6 @@ python:
- "pypy"
env:
- DJANGO=Django==1.4.17
- DJANGO=Django==1.5.12
- DJANGO=Django==1.6.9
- DJANGO=Django==1.7.2
@ -27,5 +25,10 @@ script:
- PYTHONPATH=$PYTHONPATH:$PWD coverage run --source=defender $(which django-admin.py) test defender --settings=defender.travis_settings
- coverage report -m
matrix:
exclude:
- python: "2.6"
env: DJANGO=Django==1.7.2
after_success:
- coveralls --verbose

View file

@ -120,7 +120,7 @@ to improve the login.
requirements
============
- django: 1.4.x, 1.5.x, 1.6.x, 1.7.x
- django: 1.6.x, 1.7.x
- redis
- python: 2.6.x, 2.7.x, 3.3.x, 3.4.x, PyPy

View file

@ -1,6 +1,10 @@
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class AccessAttempt(models.Model):
user_agent = models.CharField(
max_length=255,
@ -31,8 +35,8 @@ class AccessAttempt(models.Model):
class Meta:
ordering = ['-attempt_time']
def __unicode__(self):
def __str__(self):
""" unicode value for this model """
return u"{0} @ {1} | {2}".format(self.username,
self.attempt_time,
self.login_valid)
return "{0} @ {1} | {2}".format(self.username,
self.attempt_time,
self.login_valid)

View file

@ -32,7 +32,7 @@ def mock_get_connection():
# Django >= 1.7 compatibility
try:
LOGIN_FORM_KEY = '<form action="/admin/" method="post" id="login-form">'
LOGIN_FORM_KEY = '<form action="/admin/login/" method="post" id="login-form">'
ADMIN_LOGIN_URL = reverse('admin:login')
except NoReverseMatch:
ADMIN_LOGIN_URL = reverse('admin:index')

View file

@ -37,6 +37,6 @@ setup(name='django-defender',
author_email='kencochrane@gmail.com',
license='Apache 2',
packages=['defender'],
install_requires=['django==1.6.8', 'redis==2.10.3', 'hiredis==0.1.4', ],
install_requires=['Django>=1.6,<1.8', 'redis==2.10.3', 'hiredis==0.1.4', ],
tests_require=['mock', 'mockredispy', 'coverage', 'celery'],
)