Based on the Django Locking plugin at stdbrouw/django-locking. Forked to fix a number of issues and add in funcitonality to show and edit locks in list mode. Installation through Pip (pip install django-locking) subm branch provides git submodule format but is not supported. Configuration: 1) Add locking to list of INSTALLED_APPS in project settings file 2) Add locking js/css/image media files to admin media folder 3) Add the following Media elements in the app admin file to correspond with the media folder: Note: If using a newer version of django-grappelli (e.g. 2.3.5), you may have to create an alternate variable in the settings file that doesn't point to the grappelli folder (i.e. STANDARD_ADMIN_MEDIA_PREFIX) class Media: js = ( ..., settings.ADMIN_MEDIA_PREFIX + "locking/js/jquery.url.packed.js", "/ajax/admin/variables.js", settings.ADMIN_MEDIA_PREFIX + "locking/js/admin.locking.js?v=1") css = ( ..., "all": ( ..., settings.ADMIN_MEDIA_PREFIX + "locking/css/locking.css", ) ) 4) Also add this to the admin file. The changelist_view allows get_lock_for_admin access to the request object. from locking import admin as locking_admin # In your ModelAdmin class get_lock_for_admin = locking_admin.get_lock_for_admin def changelist_view(self, request, extra_context=None): ''' We need the request objects in a few places where it's usually not present, so we are adding it to PostAdmin object ''' self.request = request return super(PostAdmin, self).changelist_view(request, extra_context) 5) Run syncdb for an initial project or create a migration with south to build the database tables manage.py schemamigration locking --auto manage.py migrate locking 6) To use the list display icon, add the "get_lock_for_admin" method to the list display in the app admin file like so: from locking.admin import get_lock_for_admin class AppAdmin(admin.ModelAdmin): list_display = [..., "get_lock_for_admin"]
frnhr/django-locking
Prevents users from doing concurrent editing in Django. Works out of the box in the admin interface, or you can integrate it with your own apps using a public API.
PythonNOASSERTION