Django, custom tag… how?
问题 I would like to make a django custom tag to display 10 entry titles from the category where the user is reading an article. How can I do this? I need to pass the category from the actual entry. 回答1: The best way to do this would be with an inclusion tag. This is a tag that renders a template fragment which renders the 10 related articles. You just pass in the current article into the tag, and return the context for the template fragment - ie the related articles. @register.inclusion_tag(