context_processors: Created basic context processor for setting base template #423
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Inspired by the tips of django-htmx docs, I created a context processor that sets the base template to a partial template if the request is a htmx request, else to a full template.
This pull request currently has a basic implementation with some hard-coded values that will not be suitable for django-htmx.
The hard-coded values are of both the base_template variable and it's value. To eliminate this, I am going to make the function to look for both values in the
settings.py
file. For example:If the variable or some of it's values doesn't exist, I will use the above as the default.
Another thing is to allow a user to override this values, perhaps by calling a function, but that can wait.
Now, I need green light to proceed. What do you think?