1👍
Daniel is refering to an Inclusion Tag
Basically, a custom template tag is used for scenarios like yours (… code reusability amongs many other advantages)
Also this post might be helpful: Django Custom Inclusion Tags
Another approach could be using template inheritance
– create a base template, which defines the layout, and override the blocks of code that would change for specific views.
Here is an example of template inheritance: https://docs.djangoproject.com/en/dev/topics/templates/#template-inheritance
- [Answer]-Backbone.js appending [] to key name on fetch
- [Answer]-Checking HTTP Status code django
- [Answer]-Django – current/request user is not passed in the template
Source:stackexchange.com