forked from theatlantic/django-locking
-
Notifications
You must be signed in to change notification settings - Fork 1
ortsed/django-locking
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Based on the Django Locking plugin at stdbrouw/django-locking. Forked to fix a number of issues and add in functionality to show and edit locks in list mode. Installation through Pip (pip install django-locking) Configuration: 1) Add locking to list of INSTALLED_APPS in project settings file 2) Add locking urls to the app urls.py file: url(r'^ajax/admin/', include('locking.urls')), 3) 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 4) Run manage.py collectstatic to pull locking static content into the project 5) 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", ) ) 6) To use the changelist locking icon, add the "get_lock_for_admin" method to the list display in the admin class for the app. Also, so the changelist view has access to the request object, it has to be explicitly passed: from locking import admin as locking_admin class ModelAdmin(admin.ModelAdmin): get_lock_for_admin = locking_admin.get_lock_for_admin list_display = [field1, field2, ..., '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 ModelAdmin object ''' self.request = request return super(ModelAdmin, self).changelist_view(request, extra_context)
About
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.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 77.5%
- JavaScript 22.5%