Sunil Mohan Adapa 2a0239b6ba
users: Fix deleting user LDAP entry with Django 4.0
Helps: #2228.

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>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-20 10:23:17 -04:00
..
2022-02-12 17:01:14 -05:00