learning-unlimited / ESP-Website

A website to help manage the logistics of large, short-term educational programs
82 stars 57 forks source link

Theme template loader #3618

Closed willgearty closed 1 year ago

willgearty commented 1 year ago

This PR does the following:

  1. Adds a new theme template loader. This loads theme templates (if they exist) after the template override loader and before the normal django template loader. This means that template overrides can still override the theme, but the theme templates will always override the default templates.
  2. Upgrades the template override loader to Django 1.11+. I have a strong feeling this would have broken when we upgrade to django 2+, so it's probably good to update it now.
  3. Modifies the debug toolbar template panel to work with template overrides (before, you couldn't see the content of a template override, nor would you know that it was a template override).
  4. Update the clear_theme() and load_theme() methods to not add/remove template overrides, because template overrides of the theme are now intended as overrides. Unfortunately, we'll need to manually delete the template overrides that were made by the theme (but not actual overrides) during the next stable release.

Here is an image of the updated debug toolbar template panel showing templates that were loaded by the 3 different loaders: image

Fixes https://github.com/learning-unlimited/ESP-Website/issues/2046 (also see https://github.com/learning-unlimited/ESP-Website/issues/2098)