Support validating cache backends on Django 1.6 and 1.11.
Review Request #10506 — Created April 3, 2019 and submitted — Latest diff uploaded
This adds support for validating the cache backend in the General
Settings page on Django 1.11. We no longer have access toget_cache()
,
which was present on Django 1.6, so we now duplicate the functionality
by importing the backend manually and then constructing an instance of
the backend.In order to test this on Django 1.11, a change needed to be made to the
cache field display logic for the form. Modern versions set the
required
attribute on required fields, which meant that the form
couldn't be submitted due to the hidden fields for other backends. We
now dynamically set therequired
field based on the current backend
and the presence of arequired
CSS class on the label (which is
available on both).
Tested the form on Django 1.6 and 1.11. Checked for both validation
failures and successful validation.