I
I
Ivan2015-08-11 12:06:01
Django
Ivan, 2015-08-11 12:06:01

django-import-export. How to disable the creation of empty cells?

Good day. I am trying to import xls table. There are only a few rows and columns filled in. How can I make django-import-export not create those empty cells? And then when importing, in addition to what is needed, it also creates empty cells in the database and assigns them None values. Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Fateev, 2015-08-11
@ATNC

If you need to exclude some columns altogether, then:

class Meta:
        model = MyModel
        exclude = ('some_column', )

And in order to exclude rows that match / do not match some conditions, you need to override the skip_row method of import_export.resources.Resource

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question