Django templates vs Macros

asked 2018-12-23 20:10:03 -0500

I have recently started examining how to implement design changes to some parts of the site and got trapped in a bunch of templates and macros. My question is, from a developer perspective, why some parts of the Askbot interface is using more Macros than the Django template language? What is the advantage of each of these?

Let me give you an example: I wanted to make a small change to the user card, let's say, to create a configuration that will remove the reputation information. I was amazed by how many levels of templates and macros I had to change to get that working. For instance, you start at the template askbot/templates/question/question_author_info.html which starts the following hierarchy of macros:

  • macros post_last_updater_and_creator_info(question)
  • macro post_contributor_info(revision, contributor_type)
  • macro post_contributor_avatar_and_credentials(revision)
  • macro post_contributor_avatar_and_credentials(revision)
  • macro user_card(user) [who finally calls the template widgets/user_card.html]

Is this normal or I ended up choosing the most complicated piece of the interface to play with?

edit retag flag offensive close merge delete