Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Different Model to Excel transformation #2

Open
gbieli opened this issue May 2, 2022 · 0 comments
Open

Different Model to Excel transformation #2

gbieli opened this issue May 2, 2022 · 0 comments

Comments

@gbieli
Copy link

gbieli commented May 2, 2022

Hi,
For my project I would need another model to excel transformation like described below.

Let's say I have this model:

class Project(XlsxModel):
    project_name: str
    customer_name: str

    class Config:
        allow_population_by_field_name = True

        @classmethod
        def alias_generator(cls, string: str) -> str:
            return ''.join(word.capitalize() for word in string.split('_'))

project_example = Project(project_name="Test Project", customer_name="Example Customer")
project_example.to_file("project_example.xlsx")

this would result in:

ProjectName CustomerName
Test Project Example Customer

I would like to have something like this:

ProjectName Test Project
CustomerName Example Customer

Is this possilbe somehow?

Regards,
Gérard

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant