0

I have integrated the MongoDB database with CVAT. I get "Could not login" Error when I try to login second time into CVAT portal. I get below error in browser console (full error screenshot attached) "FAILED SQL: INSERT INTO "auth_user_groups" ("user_id", "group_id") VALUES (%(0)s, %(1)s)" I know that this is because django has not deleted the session id in database in auth_user_groups collection for first time login-logout. How can I fix this issue and make sure I will be able login-logout multiple times without having to manually delete session id in mongoDB ,auth_user_groups collection. [browser console error in DB][1]

tec data
  • 11
  • 5

1 Answers1

0

You can use Django signal like this :

models.py (you can put your script in another file of your choice)

from django.contrib.auth.signals import user_logged_out


def delete_session_id(sender, user, request, **kwargs):
    # Delete the Django session Id here

# Connect the function to user_logged_out signal
user_logged_out.connect(delete_session_id)
Rvector
  • 2,312
  • 1
  • 8
  • 17