Requiring acceptance of SLA/TOS when it changes

Hi,

We have a legal requirement to track which versions of SLAs/TOSs have been accepted by users, and to prompt them to accept the new version in case it changes.

I have been working to do that using a strategy suggested by claude:

  • creating a new model to record which version of the SLA has been accepted
  • hook it to the registration form
  • add a middleware which checks it on every page, and redirects to a page to accept it if it’s not the latest version

The code for the model/form is in this commit:

https://github.com/calculquebec/custom-extra-fields/commit/8088f6bb4bc6ac8b0d626577e39e16e4542983eb

and the code for the middleware is here:

https://github.com/calculquebec/custom-extra-fields/commit/88ac063d5bc8f2e1c5d2557d88657760b236bc01

However, when it redirects to the page /sla/accept, the site seems to not find the page. Is there something obvious that is missing ?

I hook the middleware with the following in the settings:

MIDDLEWARE.insert(MIDDLEWARE.index('openedx.core.djangoapps.cache_toolbox.middleware.CacheBackedAuthenticationMiddleware') + 1, 'custom_extra_fields.middleware.SlaAcceptanceMiddleware')

Alternatively, do you think this is not a good approach and could you suggest a better one ?

For those who may be wondering, I managed to fix the workflow with Gemini. See the latest commits