cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
682
Views
0
Helpful
2
Replies

Jinja2 Template Design Principles

Jerems
Spotlight
Spotlight

Hi Team,

I wondered if one of you could share some Jinja2 Template design principles (What to do / What not to do) please ?

Any link would be appreciated !

Thanks in advance,

Jerems

1 Accepted Solution

Accepted Solutions

Nabsch
Spotlight
Spotlight

Hello,

 

I used Jinja in some script.

 

Here some stuff that i used:

  • I use dictionnary to pass Data to the template ==> It's simplify thing because you have to add your new element to dictionnary then just use it in your template otherwise if you pass directly variable you have to modify it 3 times ..
  • You have to check how you want to deal with whitespace & newline break
  • You have to check how you want to deal  with variable that has  None as value. Do you want to pass None or just replace by empty string for exemple

Here a Link that might help you 

View solution in original post

2 Replies 2

Nabsch
Spotlight
Spotlight

Hello,

 

I used Jinja in some script.

 

Here some stuff that i used:

  • I use dictionnary to pass Data to the template ==> It's simplify thing because you have to add your new element to dictionnary then just use it in your template otherwise if you pass directly variable you have to modify it 3 times ..
  • You have to check how you want to deal with whitespace & newline break
  • You have to check how you want to deal  with variable that has  None as value. Do you want to pass None or just replace by empty string for exemple

Here a Link that might help you 

Hi Nabasch,

Thanks a lot for your hints and support as well as for the provided link.

Jerems

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: