Skip to content

Commit

Permalink
Merge tag 'v2.5.3' into develop
Browse files Browse the repository at this point in the history
fixed bug with choices that have 0 value v2.5.3

# gpg: Signature made Mon Apr  1 02:45:24 2019 CEST
# gpg:                using RSA key 149325FD15904E9C4EB89E95E81444E9CE1F695D
# gpg: Good signature from "Rick van Hattem <wolph@wol.ph>" [ultimate]
# gpg:                 aka "[jpeg image of size 9662]" [ultimate]
  • Loading branch information
wolph committed Apr 1, 2019
2 parents 3dd4639 + 5eb2227 commit 0bb395e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion django_utils/__about__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__package_name__ = 'django-utils2'
__version__ = '2.5.2'
__version__ = '2.5.3'
__author__ = 'Rick van Hattem'
__author_email__ = 'Rick.van.Hattem@Fawo.nl'
__description__ = (
Expand Down
6 changes: 3 additions & 3 deletions django_utils/choices.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __new__(cls, name, bases, attrs):
has_values = False
for key, value in six.iteritems(attrs):
if isinstance(value, Choice):
if value.value:
if value.value is None:
has_values = True

if not value.label:
Expand All @@ -209,8 +209,8 @@ def __new__(cls, name, bases, attrs):
i = 0
for key, value in sorted(choices, key=lambda c: c[1].order):
if has_values:
assert value.value, ('Cannot mix choices with and without '
'values')
assert value.value is None, (
'Cannot mix choices with and without values')
else:
value.value = i
i += 1
Expand Down

0 comments on commit 0bb395e

Please sign in to comment.