Custom template filters and tags can be confusing and inconsistent if you don't have guidelines to follow. It is essential to have both handy and flexible template filters and tags that should serve template editors as much as possible. In this recipe, we will take a look at some conventions that you should use when enhancing the functionality of the Django template system:
- Don't create or use custom template filters or tags when the logic for the page fits better in the view, context processors, or model methods. When your content is context-specific, such as a list of objects or an object-detail view, load the object in the view. If you need to show some content on nearly every page, create a context processor. Use custom methods of the model instead of template filters when you need to get some properties...