Could you elaborate on how this is different from extending a base template
and re-defining the necessary blocks?

#base.html
{% block title %}{{ section.title }}{% endblock %}
.....

{% extends "base.html" %}{% block title %} My custom title that isn't
section.title {% endblock %}
....

This much is already possible right?


On Tue, Jun 16, 2020 at 10:34 AM Josh Smeaton <josh.smea...@gmail.com>
wrote:

> 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
> <https://groups.google.com/d/msgid/django-developers/6cf43971-1ea9-4b93-9a35-aaab5908327co%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAF_6RoMTbiq4S9qFBL1qU4B_KcJU%3DveP2%3D%2BMaT0%3D1Uxee%2BiEAQ%40mail.gmail.com.

Reply via email to