
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
django-tabular-permissions
Advanced tools
Display django permissions in a tabular format that is user friendly, and highly customisable
django-tabular-permissions ########################## Display django permissions in a user friendly, translatable and customizable widget .
.. image:: https://rasystems.io/static/images/tabular_permissions/tp_1.png :target: https://rasystems.io/static/images/tabular_permissions/tp_1.png :alt: Basic demo
RTL and localized
.. image:: https://rasystems.io/static/images/tabular_permissions/tp_ar.png :target: https://rasystems.io/static/images/tabular_permissions/tp_ar.png :alt: RTL and localized
With Custom permission behaviour
.. image:: https://rasystems.io/static/images/tabular_permissions/tp_extra.png :target: https://rasystems.io/static/images/tabular_permissions/tp_extra.png :alt: With Custom permission
2.9.1 (June 7 2022)
FilteredSelectMultiple widget will appear only if you have custom permissions that are not model related (ie directly created by code or hand)You can install django-tabular-permissions via Pypi::
pip install django-tabular-permissions
and add "tabular_permissions" to your INSTALLED_APPS setting (at any place after django.contrib.auth) ::
INSTALLED_APPS = [
'django.contrib.auth',
....
'tabular_permissions',
]
Finally, execute::
python manage.py collectstatic
then navigate to User and/or Group change form to see tabular_permissions in action.
Tabular permissions possible configurations and their default::
TABULAR_PERMISSIONS_CONFIG = {
'template': 'tabular_permissions/admin/tabular_permissions.html',
'exclude': {
'override': False,
'apps': [],
'models': [],
'function':'tabular_permissions.helpers.dummy_permissions_exclude'
},
'auto_implement': True,
'use_for_concrete': False,
'custom_permission_translation': 'tabular_permissions.helpers.custom_permissions_translator',
'apps_customization_func': 'tabular_permissions.helpers.apps_customization_func',
'custom_permissions_customization_func': 'tabular_permissions.helpers.custom_permissions_customization_func',
}
template
the template which contains the permissions table, you can always customize this template by extending or overriding.
Notice that there is a style block which you can override to easily edit the css.
exclude
Control which apps, models to show in the permissions table.
By default tabular_permissions exclude sessions , contenttypes and admin apps from showing their models in the permissions table. If you want to show them you can switch override to False.
apps & models lists would contain the names of the apps and models you wish to exclude.
function is a dotted path of a custom function which receive the model as a parameter to decide either to exclude it or not, default to a dummy function that always return False (ie do not exclude)
auto_implement
By default, just by including tabular_permissions in your installed_apps, the django.contrib.admin.UserAdmin (and GroupAdmin) are "patched" to include the tabular_permissions widget.
If you have a custom UserAdmin, then set this option to False and make sure you either:
tabular_permissions.admin.TabularPermissionsUserAdmin and tabular_permissions.admin.TabularPermissionsGroupAdmin for User & Group ModelAdmin.tabular_permissions.admin.UserTabularPermissionsMixin and tabular_permissions.admin.GroupTabularPermissionsMixin (comes before admin.ModelAdmin in the mro),tabular_permissions.widgets.TabularPermissionsWidget and remember to send a 3rd argument 'permissions' for Group Model Admin.
See tabular_permissions.admin for information.use_for_concrete Default: False (new in version 2.8)
There was an inconsistency with proxy models permissions (Django ticket 11154 <https://code.djangoproject.com/ticket/11154>) which got fixed in Django 2.1
In case you're on an django <2.1 and you have proxy models and you created their permissions by hand (via this gist <https://gist.github.com/magopian/7543724> maybe), then turn off this option in order to correctly assign your newly created permissions.
For django > 2.1, leave it as is you should be good.
custom_permission_translation
A dotted path function to translate the custom permission.
This function gets passed the permissions codename, verbose_name and its relevant content_type_id.
The function will try to translate the permission verbose_name.
apps_customization_func A dotted path function to control the whole permissions objects passed to the widget. Sometimes you use custom menu where apps and models are ordered in a more "user friendly" manner and not necessarily in the "actual programmatic" apps & models order. You can use this option to get a hold of the whole ordered dict and shuffle its content around moving models from one app to the other and do all kind of crazy stuff to get just the right table of permissions.
custom_permissions_customization_func
A dotted path function to control the "extra" permissions which will be displayed on the default django widget.
Suppose a model is removed, or an app is commented out of INSTALLED_APPS; its permissions are still in the
permissions table, and it will be picked up.
Use this function to manipulate and order those permissions and return them .
The permissions are passed a list of tuples , like this [(perm_id, perm_name), (perm_id, perm_name), ...]
Located at 'static/tabular_permissions/tabular_permissions.js', it have 2 responsibilities:
select-all checkboxes.Current version support from Python 2.7 and up to Python 3.10, and Django from 1.11 to 4.1 For Django < 1.11, use django-tabular-permissions 1.0.9.
To run the demo project in the repo on your local you need
pip install django-tabular-permissionspython manage.py migratepython manage.py runserverTo run the tests, you need to install the test requirements::
cd tests
pip install -r requirements.txt
Then run::
python runtests.py
With Coverage ::
coverage run runtests.py
coverage html
If you like this package, chances are you may like those packages too!
Django Slick Reporting <https://github.com/ra-systems/django-slick-reporting>_ Powerful and Efficient reporting engine with Charting capabilities.
Django Ra ERP Framework <https://github.com/ra-systems/RA>_ A framework to build business solutions with ease.
FAQs
Display django permissions in a tabular format that is user friendly, and highly customisable
We found that django-tabular-permissions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.