-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add django 1.8/1.9 compatibility. Drop unsupported django versions su…
…pport
- Loading branch information
Showing
6 changed files
with
32 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
class ParsleyChoiceFieldRendererMixin(object): | ||
def __iter__(self): | ||
for i, choice in enumerate(self.choices): | ||
yield self[i] | ||
def __init__(self, name, value, attrs, choices): | ||
self.name = name | ||
self.value = value | ||
self.attrs = attrs | ||
self._choices = choices | ||
|
||
def __getitem__(self, idx): | ||
choice = self.choices[idx] | ||
if idx == len(self.choices) - 1: | ||
self.attrs["{prefix}-required".format(prefix=self.parsley_namespace)] = "true" | ||
return super(ParsleyChoiceFieldRendererMixin, self).__getitem__(idx) | ||
@property | ||
def choices(self): | ||
def choices_iter(): | ||
choices_list = self._choices | ||
for idx, choice in enumerate(choices_list): | ||
if idx == len(choices_list) - 1: | ||
self.attrs["{prefix}-required".format(prefix=self.parsley_namespace)] = "true" | ||
yield choice | ||
return choices_iter() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,15 @@ | ||
[tox] | ||
envlist = | ||
py26-1.3, py26-1.4, py26-1.5, py26-1.6, | ||
py27-1.3, py27-1.4, py27-1.5, py27-1.6, py27-trunk, | ||
py32-1.5, py32-1.6, py32-trunk, | ||
py33-1.5, py33-1.6, py33-trunk, | ||
envlist = py{27,34,35}-dj{18,19} | ||
skipsdist = True | ||
|
||
|
||
[testenv] | ||
commands = coverage run -a setup.py test | ||
|
||
|
||
[testenv:py26-1.3] | ||
basepython = python2.6 | ||
deps = | ||
django == 1.3.7 | ||
coverage == 3.6 | ||
|
||
[testenv:py26-1.4] | ||
basepython = python2.6 | ||
deps = | ||
django == 1.4.2 | ||
coverage == 3.6 | ||
|
||
[testenv:py26-1.5] | ||
basepython = python2.6 | ||
deps = | ||
django == 1.5 | ||
coverage == 3.6 | ||
|
||
[testenv:py26-1.6] | ||
basepython = python2.6 | ||
deps = | ||
https://github.com/django/django/tarball/stable/1.6.x | ||
coverage == 3.6 | ||
|
||
[testenv:py26-trunk] | ||
basepython = python2.6 | ||
deps = | ||
https://github.com/django/django/tarball/master | ||
coverage == 3.6 | ||
|
||
|
||
[testenv:py27-1.3] | ||
basepython = python2.7 | ||
deps = | ||
django == 1.3.7 | ||
coverage == 3.6 | ||
|
||
[testenv:py27-1.4] | ||
basepython = python2.7 | ||
deps = | ||
django == 1.4.2 | ||
coverage == 3.6 | ||
|
||
[testenv:py27-1.5] | ||
basepython = python2.7 | ||
deps = | ||
django == 1.5 | ||
coverage == 3.6 | ||
|
||
[testenv:py27-1.6] | ||
basepython = python2.7 | ||
deps = | ||
https://github.com/django/django/tarball/stable/1.6.x | ||
coverage == 3.6 | ||
|
||
[testenv:py27-trunk] | ||
basepython = python2.7 | ||
deps = | ||
https://github.com/django/django/tarball/master | ||
coverage == 3.6 | ||
|
||
|
||
[testenv:py32-1.5] | ||
basepython = python3.2 | ||
deps = | ||
django == 1.5 | ||
coverage == 3.6 | ||
|
||
[testenv:py32-1.6] | ||
basepython = python3.2 | ||
deps = | ||
https://github.com/django/django/tarball/stable/1.6.x | ||
coverage == 3.6 | ||
|
||
[testenv:py32-trunk] | ||
basepython = python3.2 | ||
deps = | ||
https://github.com/django/django/tarball/master | ||
coverage == 3.6 | ||
|
||
|
||
|
||
[testenv:py33-1.5] | ||
basepython = python3.3 | ||
deps = | ||
django == 1.5 | ||
coverage == 3.6 | ||
|
||
[testenv:py33-1.6] | ||
basepython = python3.3 | ||
deps = | ||
https://github.com/django/django/tarball/stable/1.6.x | ||
coverage == 3.6 | ||
|
||
[testenv:py33-trunk] | ||
basepython = python3.3 | ||
deps = | ||
https://github.com/django/django/tarball/master | ||
coverage == 3.6 | ||
basepython = | ||
py27: python2.7 | ||
py34: python3.4 | ||
py35: python3.5 | ||
deps = | ||
coverage>=4 | ||
dj18: django==1.8.13 | ||
dj19: django==1.9.7 |