makemigrations command in Django (1.9) does not recognize Blank = True in a boolean field

0

I have the following template:

class Site(models.Model):
    """
    Model for a site entry
    @author: Leonardo Pessoa
    @since: 05/09/2016 
    """
    from decimal import Decimal

    consolidated_financials     = models.BooleanField(blank=True)
    type                        = models.ForeignKey(Type)
    tier1_business              = models.ForeignKey(Business, limit_choices_to = {'tier': 1}, related_name='%(class)s_tier1')

Note that the consolidated_financials field now has the blank=True parameter that did not exist in the first version of the template. When I run makemigrations , Django does not recognize the change, but when I add in a field other than BooleanField , yes. Is there any restriction with this particular field?

    
asked by anonymous 28.10.2016 / 09:59

1 answer

1

The field BooleanField does not take as parameter null=True . Instead, use NullBooleanField .

You have a great answer in the Programmers.se of Jacob Maristany that says:

  

If you allow null, you are transforming a binary (true / false) field into ternary (true / false / null) where your null entries are indeterminate.

For the full discussion, see: Should I store False as Null in a boolean field database?

    
28.10.2016 / 09:59