Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在龙卷风模板中创建一个块,这个块必须在子模板中替换(就像一个抽象方法必须在子类中被覆盖)。
如何实现“抽象块”?
为什么需要这么奇怪的东西?
好的,这是你通往程序员噩梦之路的轮子:
模块未实现:
raise Exception('Not implemented template block')
父模板:
{% block abstract %} {% import not_implemented %} {% end %}
子模板:
{% extends 'parent.html' %} {% block abstract %}{% end %}