In my User Model, I have set the following fields:
is_deactivated = models.BooleanField(default=False)
deactivation_initiated = models.DateTimeField(null=True)
deactivate_at = models.DateTimeField(null=True)
Whenever any User interacts with anything on the App (clicking a button, refreshing a page, etc.), I would like to check whether is_deactivated is True. If it is True, then I would like to compare the current real-world time with the deactivate_at time.
If the deactivate_at time has passed. Then I would like to automatically log the user out, and set is_active=False for the user.
I am unsure of how to implement something like this.