django-extra-settings
django-extra-settings copied to clipboard
Cannot import table because of null constraints
Python version 3.10
Django version 4.0.6
Package version 0.5.1
Current behavior (bug description) I am trying to import from an Excel file with django-import-export. But, since the models contain blank=True, but not null=True on the fields, the database treats them as required fields and throws a not-null constraint violation. Quickly verified a resolution by changing
value_email = models.EmailField(blank=True, verbose_name=_("Value"))
to
value_email = models.EmailField(blank=True, null=True, verbose_name=_("Value"))
After running makemigrations/migrate, it worked fine.
Expected behavior I want to be able to import tables to new implementations of my application.
@joefessenden thank you for reporting this, could you submit a PR including a test case for this issue please?
@fabiocaccamo Let me work on that. Not sure how I would create a test case for automated testing that relies on the import package that is not part of core django. It's sorta a compatibility issue, I guess, but I do think it's an issue on this side rather than the import side since we allow for blanks in the form and not nulls in the database in the model. (Open to learning I'm wrong about how the models work).
@joefessenden a simple failing test with null values is enought (just to avoid regressions), don't waste too much time on it.
@joefessenden any update?
@joefessenden I close this issue because it is stale, it you continue to contribute on it I will re-open it.