Skip to content

Commit

Permalink
include locale in manifest, fix a problem with exclude settings, use …
Browse files Browse the repository at this point in the history
…plural instead of singular in exclude apps and models settings, ui enhancement, version bump.

include locale in manifest, fix a problem with exclude settings, use plural instead of singular in exclude apps and models settings, ui enhancement, version bump.
  • Loading branch information
RamezIssac committed Jul 1, 2018
1 parent 1225457 commit 9a25173
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
----------
CHANGELOG
----------
v 2.0.2 (July 1 2018)
- Include locale in manifest
- fix a problem with exclude settings & use plural instead of singular in exclude apps and models settings,
- Fix RTL checkbox alignment issue


v 2.0 (June 30 2018)

Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include LICENSE
include README.rst
recursive-include tabular_permissions/static *
recursive-include tabular_permissions/templates *
recursive-include tabular_permissions/templates *
recursive-include tabular_permissions/locale *
10 changes: 7 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ django-tabular-permissions
Display model permissions in a tabular widget that is user friendly, translatable and customizable.
*Scroll down for screen shots*

Version
-------
2.0.2 (July 1 2018)

Features:
---------
* Permissions and their relevant app and models names are displayed in the active language.
Expand Down Expand Up @@ -45,8 +49,8 @@ Tabular_permissions possible configurations and their default::
'template': 'tabular_permissions/admin/tabular_permissions.html',
'exclude': {
'override': False,
'app': [],
'model': [],
'apps': [],
'models': [],
'function':'tabular_permissions.helpers.dummy_permissions_exclude'
},
'auto_implement': True,
Expand All @@ -63,7 +67,7 @@ Tabular_permissions possible configurations and their default::

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`.

``app`` & ``model`` lists would contain the names of the apps and models you wish to exclude.
``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)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='django-tabular-permissions',
version='2.0',
version='2.0.2',
packages=['tabular_permissions'],
include_package_data=True,
license='BSD License',
Expand Down
2 changes: 1 addition & 1 deletion tabular_permissions/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0'
__version__ = '2.0.2'
14 changes: 9 additions & 5 deletions tabular_permissions/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
'template': 'tabular_permissions/admin/tabular_permissions.html',
'exclude': {
'override': False,
'app': [],
'model': [],
'apps': [],
'models': [],
'function':'tabular_permissions.helpers.dummy_permissions_exclude'
},
'auto_implement': True,
Expand All @@ -16,6 +16,10 @@
user_conf = getattr(settings, 'TABULAR_PERMISSIONS_CONFIG', False)

if user_conf:
# we update the exclude dict first
TABULAR_PERMISSIONS_CONFIG['exclude'].update(user_conf.get('exclude', {}))
user_conf['exclude'] = TABULAR_PERMISSIONS_CONFIG['exclude']
# update the rest if the configuration
TABULAR_PERMISSIONS_CONFIG.update(user_conf)

AUTO_IMPLEMENT = TABULAR_PERMISSIONS_CONFIG['auto_implement']
Expand All @@ -24,12 +28,12 @@
_base_exclude_apps = ['sessions', 'contenttypes', 'admin']
user_exclude = TABULAR_PERMISSIONS_CONFIG['exclude']
if not user_exclude.get('override', False):
EXCLUDE_APPS = _base_exclude_apps + user_exclude.get('app', [])
EXCLUDE_APPS = _base_exclude_apps + user_exclude.get('apps', [])
else:
EXCLUDE_APPS = user_exclude.get('app', [])
EXCLUDE_APPS = user_exclude.get('apps', [])
EXCLUDE_APPS = [x.lower() for x in EXCLUDE_APPS]

EXCLUDE_MODELS = user_exclude.get('model', [])
EXCLUDE_MODELS = user_exclude.get('models', [])
EXCLUDE_MODELS = [x.lower() for x in EXCLUDE_MODELS]

model_exclude_func = user_exclude.get('function')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
data-input-name="{{ input_name }}">
<thead>
<tr>
<th> {% trans 'application' %}</th>
<th>{% trans 'model' %}</th>
<th> {% trans 'application'|capfirst %}</th>
<th>{% trans 'model'|capfirst %}</th>
<th>
{% trans 'Add' %}
<div>
Expand All @@ -32,7 +32,7 @@
</th>
{% if custom_permissions_available %}
<th>
{% trans 'other permissions' %}
{% trans 'other permissions'|capfirst %}
</th>
{% endif %}
</tr>
Expand Down Expand Up @@ -101,7 +101,7 @@
{% if custom_permissions_available %}
<td>
{% for custom_permission in model.custom_permissions %}
<div class="checkbox ">
<div class="input ">
<label>
<input type="checkbox" class="checkbox custom model-{{ model.model_name }}"
id="id_{{ custom_permission.0 }}" data-perm-id="{{ custom_permission.2 }}"
Expand Down
1 change: 1 addition & 0 deletions tabular_permissions/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def render(self, name, value, attrs=None, renderer=None):

for app in apps.get_app_configs():
app_dict = {'verbose_name': force_text(app.verbose_name),
'label': app.label,
'models': []}

for model_name in app.models:
Expand Down

0 comments on commit 9a25173

Please sign in to comment.