A Django application that enables real-time collaborative editing in the Django admin interface. This package allows multiple admin users to work together while preventing concurrent edits to the same object.
pip install django-admin-collaborator
INSTALLED_APPS = [ ... 'channels', 'django_admin_collaborator', ... ]
CHANNEL_LAYERS = { 'default': { 'BACKEND': 'channels_redis.core.RedisChannelLayer', 'CONFIG': { 'hosts': [('127.0.0.1', 6379)], }, }, }
django_asgi_app = get_asgi_application() from django_admin_collaborator.routing import websocket_urlpatterns application = ProtocolTypeRouter({ 'http': get_asgi_application(), 'websocket': AuthMiddlewareStack( URLRouter( websocket_urlpatterns ) ), })
You can customize the behavior of django-admin-collaborator by adding the following settings to your settings.py:
ADMIN_COLLABORATOR_OPTIONS = { 'editor_mode_text': 'You are in editor mode.', 'viewer_mode_text': 'This page is being edited by {editor_name}. You cannot make changes until they leave.', 'claiming_editor_text': 'The editor has left. The page will refresh shortly to allow editing.', 'avatar_field': None, # Set to a field name in your User model to display avatars 'notification_request_interval': 15, # Seconds between notification requests 'notification_message': 'User {username} is requesting the editors attention.', 'notification_button_text': 'Request Editor Attention', 'notification_request_sent_text': 'Request sent.', # Chat settings 'enable_chat': True, # Enable/disable the chat feature 'chat_user_list_title': 'Online Users', # Title for the user list panel 'chat_empty_state_text': 'No other users online', # Text when no users are online 'chat_start_conversation_text': 'No messages yet. Start the conversation!', # Text for empty chat 'chat_input_placeholder': 'Type a message...', # Placeholder text for chat input field 'chat_online_status_text': 'Online', # Text for online status indicator } ADMIN_COLLABORATOR_ADMIN_URL = 'admin' # Your admin URL prefix ADMIN_COLLABORATOR_REDIS_URL = 'redis://localhost:6379/0' # Redis connection URL ADMIN_COLLABORATOR_WEBSOCKET_CONNECTION_PREFIX_URL = 'admin/collaboration' # WebSocket connection URL prefix # Redis connection resilience settings ADMIN_COLLABORATOR_REDIS_MAX_RETRIES = 3 # Maximum retry attempts for Redis operations ADMIN_COLLABORATOR_REDIS_RETRY_DELAY = 0.5 # Delay between retries in seconds (uses exponential backoff) ADMIN_COLLABORATOR_REDIS_SOCKET_TIMEOUT = 5 # Redis connection timeout in seconds ADMIN_COLLABORATOR_REDIS_MAX_CONNECTIONS = 10 # Maximum connections in the Redis connection pool
from django_admin_collaborator.utils import CollaborativeAdminMixin class YourModelAdmin(CollaborativeAdminMixin, admin.ModelAdmin): ...
If you're deploying this application on Heroku, ensure that you configure the database connection settings appropriately to optimize performance:
# settings.py if not DEBUG: import django_heroku django_heroku.settings(locals()) DATABASES['default']['CONN_MAX_AGE'] = 0
These settings enable automatic retries with exponential backoff when Redis connection errors occur.
For complete documentation, please visit:
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue on the GitHub repository.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4