How to reuse code blocks easily with Jinja2 macros!

Поделиться
HTML-код
  • Опубликовано: 22 окт 2020
  • Jinja2 macros are amazing tools that help us extract from and decompose templates so that we can reuse code blocks in any other template!
    If you want to learn more about Flask, check out our Flask Tutorial for Beginners playlist: • Flask Tutorial for Beg...
    And if you want to deep dive into web development with Python, our Complete Python Web course is linked below 👇
    -- Links --
    🐍 Our Complete Python Web Course: www.udemy.com/course/the-comp...
    ✅ Subscribe to the channel: ruclips.net/user/tecladocode?s...
    ✅ Our Discord server: / discord
    ✅ Twitter: / tecladocode
    ✅ Instagram: / tecladocode
  • НаукаНаука

Комментарии • 22

  • @ivochristian
    @ivochristian 3 месяца назад

    Very good. Straight to the point

  • @hansblod3379
    @hansblod3379 Месяц назад

    This is how I like it! Mostly I hate youtube videos about coding because there is so much "boilerplate content" around it. This is pretty much straight to the point. Good one! Maybe you could add small things around the subject at hand. For example, can you add type annotations to macros and stuff. I am completely new to the subject, so maybe this point wont make any sense. But you get the point^^

    • @tecladocode
      @tecladocode  29 дней назад

      Thank you very much! Glad you liked the video. Regarding type definitions, I don't think you can do it with Jinja. You wouldn't get good editor support anyway.
      Something I have done is add a comment at the top of particularly complex macros or includes documenting the arguments it should receive and what they are for.

  • @shan27k
    @shan27k 3 года назад +1

    Very nicely explained Jinja Macros in short time, I was able to understand and implement it. Thanks

  • @ranitdey7369
    @ranitdey7369 2 года назад +1

    This is a really nice & crisp explanation.

  • @elvistermopan2944
    @elvistermopan2944 Год назад

    Great material. Thank you for sharing it.

  • @vigneshkarthikprofessional9824

    Super bro, very simplified, I'm subscribed

  • @jonascarvalho7331
    @jonascarvalho7331 2 года назад

    This is great. And makes me think somebody must create a framework using this core concept.

  • @Saccbot
    @Saccbot 2 года назад

    Beautiful, just beautiful

  • @guguladitya
    @guguladitya 7 дней назад

    I did not know macros thanks

  • @ayo9344
    @ayo9344 2 года назад

    Wow!! Do you have any other videos on jinja syntax, keywords?

  • @mafricimangmailaccount6611
    @mafricimangmailaccount6611 2 года назад

    Thanks for the video! This data in routes is static. What if we've got data in models that we want to show in a more dynamic way?

  • @vaseemmohammed8237
    @vaseemmohammed8237 3 года назад +1

    Hi, do you have any plan on creating a short series on python modules like “python docx” and “docxtpl”? Would be really helpful. Thanks!

  • @mk9834
    @mk9834 3 года назад

    thanks so much!

  • @daksheshsharma1747
    @daksheshsharma1747 3 года назад

    Hey! Just wanted to ask when the Flask Web Development Course will be updated on Udemy, since the course still has Legacy content and the course introduction says that the update would be done in November'20.

  • @rangabharath4253
    @rangabharath4253 3 года назад

    awesome. Thank u so much :)

    • @tecladocode
      @tecladocode  3 года назад +1

      Thanks Ranga! You're welcome!

  • @deemon710
    @deemon710 2 года назад

    Ooooh, slick. What if in a scenario where you use the same macro to create multiple tables, you want to pass another class name via the macro function so you can uniquely identify the table? Is that possible?

  • @888vitality
    @888vitality 2 года назад

    Cool!

  • @TheSumitBanik
    @TheSumitBanik 3 года назад +3

    This is so cool.
    So, macros help in the reusability of HTML elements, right?

  • @jimperkins9661
    @jimperkins9661 10 месяцев назад

    Now do it for a hand of 13 cards in the form {(html code, eg,) ❤(rank, eg) A} where each of the four suits has different css formatting (mainly color).