[Python] In Django `import-export` lib how to pass row if values in few rows don't meet...

Discussão em 'Python' iniciado por Stack, Setembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    I have a few dynamic fields (2) in ModelResource class. I need to export a row only if at least one of those fields has a value:

    +----+-------+-------+
    | ID | col A | col B |
    +====+=======+=======+
    | 1 | | value | # <-- exports
    +----+-------+-------+
    | 2 | value | | # <-- exports
    +----+-------+-------+
    | 3 | | | # <-- passes as no values in both columns
    +----+-------+-------+


    Is there a way to achive this goal in import-export lib or I have to edit a tablib dataset ? P.S. Data exports to Excel if that matters.

    Continue reading...

Compartilhe esta Página