generate pdf/excel files using only one view

Hello django community,
Starting by thanking Django for giving us the opportunity to exchange ideas and so on. i hope this topic will be helpful for us.
I have to generate a lot of pdf/excel files in my django project there will be a lot of views functions which i don’t like, as we used to say huge code= high maintenance.
what i’m looking for is a method that i can write a simple view to generate a lot of pdfs to my project.

Unfortunately, your description is too vague to allow for anyone to make substantive suggestions.

I’ll just make two points:

  • More code is not necessarily bad when you need to come back later and make changes. Having too much functionality wrapped up into one module can become a maintenance nightmare.

  • Personally, I’d rather have 10 views that are 10 lines each than one 100-line view that is difficult to understand with all the conditions necessary to support all the possible requirements.

i appreciate your information, my view ‘generate pdf’ already had 100 lines xD, i’m looking for a better solution if it exists.