users: Fix deleting user LDAP entry with Django 4.0
Helps: #2228 (closed).
In Django 4.0, form_valid() method should be overridden instead of delete() method. This is because DeleteView inherits from FormMixin. To make the code work for Django 2.2 and up, implement both methods but make delete() method available only after base init() so that Django does not show a warning with Django 4.0.
Tests:
-
Run unit tests on stable, testing and unstable containers.
-
Create a temporary user and delete the user. User deletion success message must be show. Create another user with the same username as the deleted user (to ensure that deletion actually happened). Perform the test on stable, testing and unstable containers.
Signed-off-by: Sunil Mohan Adapa sunil@medhas.org