Skip to content

Commit

Permalink
Fix: As in Django the default blank option for BooleanField is `T…
Browse files Browse the repository at this point in the history
…rue`
  • Loading branch information
fbuccioni committed Apr 2, 2018
1 parent 311e6f1 commit 0739a9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion django_mongoengine/fields/djangoflavor.py
Expand Up @@ -196,6 +196,11 @@ def formfield(self, **kwargs):

class BooleanField(DjangoField):

def __init__(self, *args, **kwargs):
kwargs['blank'] = True

super(BooleanField, self).__init__(*args, **kwargs)

def formfield(self, **kwargs):
# Unlike most fields, BooleanField figures out include_blank from
# self.null instead of self.blank.
Expand Down Expand Up @@ -229,7 +234,6 @@ def formfield(self, **kwargs):

# TODO: test field.field.choices?
class ListField(DjangoField):

def formfield(self, **kwargs):
if self.field.choices:
defaults = {
Expand Down

0 comments on commit 0739a9b

Please sign in to comment.