Not able to delete the users

I have created an online learning platform with open edx tutor. Now when i want to delete users from admin console. I am not able to delete the user, and getting an error page with message internal server error. How can i delete the user user from the front end interface ?

Deleting the user via Django admin doesn’t really work well, at least not when the user has active enrollments in courses and probably some other conditions.

You’re probably better off doing a CLI based removal using the manage.py commands, eg:

tutor local run lms ./manage.py lms manage_user --remove <user_name> <user_email>

if you are a developer you need to read logs to identify the error.
Because of the foreign key constraints in the database, I don’t recommend deleting users.
Just leave them or deactivate if you need to.

Open edX allows to remove a user from the django sysadmin console.

However, in some cases this procedure will render an error, so some fixes are needed before a user is ready to be removed. In particular, the following child records need to be removed before attempting to remove the user from the django sysadmin console:

  • course_creators_coursecreator
  • student_courseaccessrole
  • user_tasks_usertaskstatus (requires prior deletion of user_tasks_usertaskartifact)

Also, the username must not have special characters in order for removal to be successful.

Another option is to “remove” a user provisionally by doing the following:

  1. Use the Django sysadmin console at https://LMSDOMAIN/admin/auth/user/ to locate the user you wish to remove. Change the email associated with the user by adding any prefix to the existing email address. This action will prevent the user from logging in or changing their password.
  2. Manually remove all user enrollments in courses from the Django console at https://LMSDOMAIN/admin/student/courseenrollment/.
  3. Change the user signup source record through https://LMSDOMAIN/admin/student/usersignupsource/ to prevent user from appearing in future reports.
3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.