Skip to content

Instantly share code, notes, and snippets.

View oleglpts's full-sized avatar

Oleg Lupats oleglpts

  • Israel
View GitHub Profile
@fleepgeek
fleepgeek / apps.py
Last active September 10, 2024 20:50
A Django Middleware to prevent multiple sessions for the same user. It automatically logs out the previous session and replaces it with the new session.
from django.apps import AppConfig
class ForumConfig(AppConfig):
name = 'forum'
# This function is the only new thing in this file
# it just imports the signal file when the app is ready
def ready(self):
import your_app_name.signals