djangodjango-oscar

Django-Oscar 3.1.6 Frobshop NullBooleanField warning


Following the Frobshop docs, I installed django-oscar v3.0.0, which pulled in django v3.1.6.

Every time I run manage.py I get this warning: WARNINGS: catalogue.ProductAttributeValue.value_boolean: (fields.W903) NullBooleanField is deprecated. Support for it (except in historical migrations) will be removed in Django 4.0. HINT: Use BooleanField(null=True) instead.

I grepped for NullBooleanField in the Frobshop source, but there were no results. Is there a way to either fix the problem or suppress the message?


Solution

  • Search your Python environment folder where pip would have installed django-oscar, from there you need to find inside your environment this folder below:

    .../lib/site-packages/oscar/apps/catalogue/abstract_model.py
    

    In abstract_model.py, change line 1043 from:

    value_boolean = models.NullBooleanField(_('Boolean'), blank=True, db_index=True)
    

    to

    value_boolean = models.BooleanField(_('Boolean'), blank=True, db_index=True)
    

    You should see the warning disappear after you save the change.