Skip to content

Commit

Permalink
Merge branch 'release/0.0.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaun Sephton committed Nov 5, 2012
2 parents 58ac112 + 4049b66 commit 7f0cd38
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

0.0.7
-----
#. Pass context to object_tools tag. Thanks `slafs <https://github.com/slafs>`_

0.0.6
-----
#. Corrected 'str' object has no attribute 'has_perm' bug `#7 <https://github.com/praekelt/django-export/issues/7>`_.
Expand Down
10 changes: 10 additions & 0 deletions object_tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ def __init__(self, model):
self.model = model
self.modeladmin = site._registry.get(model)

if self.modeladmin:
self.modeladmin_changelist_view = self.modeladmin.changelist_view
self.modeladmin.changelist_view = self.changelist_view

def changelist_view(self, request, extra_context=None):
"""
Simple wrapper to pass request to admin/change_list.html
"""
return self.modeladmin_changelist_view(request, extra_context={'request': request})

def construct_form(self, request):
"""
Constructs form from POST method using self.form_class.
Expand Down
6 changes: 4 additions & 2 deletions object_tools/templatetags/object_tools_inclusion_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ def object_tools(context, model, user, exclude=None):
if tool.has_permission(user):
allowed_tools.append(tool)

ret_dict = {'object_tools': allowed_tools }
ret_dict = {'object_tools': allowed_tools}
if context.has_key('request'):
return template.RequestContext(context['request'], ret_dict)
ret_dict.update({
'request': context['request']
})

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

setup(
name='django-object-tools',
version='0.0.6',
version='0.0.7',
description='Django app enabling painless creation of additional admin object tools.',
long_description = open('README.rst', 'r').read() + open('AUTHORS.rst', 'r').read() + open('CHANGELOG.rst', 'r').read(),
author='Praekelt Foundation',
Expand Down

0 comments on commit 7f0cd38

Please sign in to comment.