Skip to content

Commit ebb3db3

Browse files
committed
rename things around
I'll probably have to do this again, but gotta start somewhere.
1 parent 01afb91 commit ebb3db3

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Diff for: django_object_actions/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
__version__ = "0.0.1"
22

33

4-
from .utils import DjObjectTools as DjangoObjectActions
4+
from .utils import DjangoObjectActions

Diff for: django_object_actions/templates/django_object_actions/change_form.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
which is "good enough".
99
{% endcomment %}
1010
{% block object-tools %}{{ block.super }}
11-
{% for tool, help in djtools %}
11+
{% for tool, help in objectactions %}
1212
<li class="djtool-item"><a href='tools/{{ tool }}/' title="{{ help }}">
1313
{# White space deliberately inserted #}
1414
{{ tool|capfirst }}

Diff for: django_object_actions/utils.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.views.generic.detail import SingleObjectMixin
66

77

8-
class DjObjectTools(object):
8+
class DjangoObjectActions(object):
99
"""
1010
mixin to add object-tools just like you would add admin actions.
1111
@@ -15,26 +15,26 @@ class DjObjectTools(object):
1515
1616
def toolfunc(self, request, obj)
1717
18-
They are exposed by putting them in a djobjecttools attribute in your
18+
They are exposed by putting them in a `objectactions` attribute in your
1919
modeladmin like:
2020
21-
class MyModelAdmin(DjObjectTools, admin.ModelAdmin):
21+
class MyModelAdmin(DjangoObjectActions, admin.ModelAdmin):
2222
def toolfunc(self, request, obj):
2323
pass
2424
toolfunc.short_description = "does nothing"
2525
26-
djobjecttools = ('toolfunc',)
26+
objectactions = ('toolfunc',)
2727
2828
Why this functionality isn't baked into contrib.admin is beyond me.
2929
3030
TODO: get `form` and `change` so you can write tools that can also save
3131
TODO: handle getting returned an HttpResponse
3232
"""
33-
change_form_template = "djobjecttools/change_form.html"
33+
change_form_template = "django_object_actions/change_form.html"
3434

3535
def get_tool_urls(self):
3636
tools = {}
37-
for tool in self.djobjecttools:
37+
for tool in self.objectactions:
3838
tools[tool] = getattr(self, tool)
3939
my_urls = patterns('',
4040
(r'^(?P<pk>\d+)/tools/(?P<tool>\w+)/$', self.admin_site.admin_view(
@@ -43,14 +43,14 @@ def get_tool_urls(self):
4343
return my_urls
4444

4545
def get_urls(self):
46-
urls = super(DjObjectTools, self).get_urls()
46+
urls = super(DjangoObjectActions, self).get_urls()
4747
return self.get_tool_urls() + urls
4848

4949
def render_change_form(self, request, context, **kwargs):
50-
context['djtools'] = [(x,
50+
context['objectactions'] = [(x,
5151
getattr(getattr(self, x), 'short_description', ''))
52-
for x in self.djobjecttools]
53-
return super(DjObjectTools, self).render_change_form(request,
52+
for x in self.objectactions]
53+
return super(DjangoObjectActions, self).render_change_form(request,
5454
context, **kwargs)
5555

5656

0 commit comments

Comments
 (0)