Something that has bugged me for awhile is the requirement to copy and 
paste an entire template when you would just like to override a single 
block. This arises mostly when overriding admin templates, like 
`admin/base.html`.

In my ideal world, I'd be able to do something like this:

    # myapp/templates/admin/base.html
    {% override "admin/base.html" %}
    {% block footer %}this site is restricted, blah blah legal text blah{% 
endblock %}


And then the template loading system would find the next `admin/base.html` 
in the chain and use my overrides.

There is prior art too. https://pypi.org/project/django-apptemplates/ 
allows you to override a template from a specific app using this syntax:

    # myapp/templates/admin/base.html
    {% extends "admin:admin/base.html" %}
    {% block footer %}this site is restricted, blah blah legal text blah{%
 endblock %}


I think this kind of functionality should be included within Django itself. 
If others agree, should there be a new name such as override, or would 
overloading extends be good enough?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/6cf43971-1ea9-4b93-9a35-aaab5908327co%40googlegroups.com.

Reply via email to