1- Django Object Actions
2- =====================
1+ # Django Object Actions
32
43[ ![ CI] ( https://github.com/crccheck/django-object-actions/actions/workflows/ci.yml/badge.svg?branch=master )] ( https://github.com/crccheck/django-object-actions/actions/workflows/ci.yml?query=branch%3Amaster )
54
65If you've ever tried making admin object tools you may have thought, "why can't
76this be as easy as making Django Admin Actions?" Well now they can be.
87
9-
10- Quick-Start Guide
11- -----------------
8+ ## Quick-Start Guide
129
1310Install Django Object Actions:
1411
@@ -30,18 +27,17 @@ class ArticleAdmin(DjangoObjectActions, admin.ModelAdmin):
3027 publish_obj(obj)
3128
3229 change_actions = (' publish_this' , )
30+ changelist_actions = (' ...' , )
3331```
3432
33+ ## Usage
3534
36- Usage
37- -----
38-
39- Defining new &* tool actions* is just like defining regular [ admin actions] . The
35+ Defining new &_ tool actions_ is just like defining regular [ admin actions] . The
4036major difference is the functions for ` django-object-actions ` will take an
41- object instance instead of a queryset (see * Re -using Admin Actions * below).
37+ object instance instead of a queryset (see _ Re -using Admin Actions _ below).
4238
43- * Tool actions * are exposed by putting them in a ` change_actions ` attribute in
44- your ` admin.ModelAdmin ` . You can also add * tool actions * to the main changelist
39+ _ Tool actions _ are exposed by putting them in a ` change_actions ` attribute in
40+ your ` admin.ModelAdmin ` . You can also add _ tool actions _ to the main changelist
4541views too. There, you'll get a queryset like a regular [ admin action] [ admin actions ] :
4642
4743``` python
@@ -72,7 +68,7 @@ you'll need to take extra care because `django-object-actions` uses them too.
7268
7369### Re-using Admin Actions
7470
75- If you would like a preexisting admin action to also be an * object action * , add
71+ If you would like a preexisting admin action to also be an _ object action _ , add
7672the ` takes_instance_or_queryset ` decorator to convert object instances into a
7773queryset and pass querysets:
7874
@@ -92,7 +88,7 @@ class RobotAdmin(DjangoObjectActions, admin.ModelAdmin):
9288
9389[ admin actions ] : https://docs.djangoproject.com/en/stable/ref/contrib/admin/actions/
9490
95- ### Customizing * Object Actions *
91+ ### Customizing _ Object Actions _
9692
9793To give the action some a helpful title tooltip, you can use the ` action ` decorator
9894and set the description argument.
@@ -191,9 +187,7 @@ If you don't intend to use the template customizations at all, don't
191187add ` django_object_actions ` to your ` INSTALLED_APPS ` at all and use
192188` BaseDjangoObjectActions ` instead of ` DjangoObjectActions ` .
193189
194-
195- More Examples
196- -------------
190+ ## More Examples
197191
198192Making an action that links off-site:
199193
@@ -203,9 +197,7 @@ def external_link(self, request, obj):
203197 return HttpResponseRedirect(f ' https://example.com/ { obj.id} ' )
204198```
205199
206-
207- Limitations
208- -----------
200+ ## Limitations
209201
2102021 . ` django-object-actions ` expects functions to be methods of the model
211203 admin. While Django gives you a lot more options for their admin
@@ -218,25 +210,19 @@ Limitations
218210 your own actions irregardless of what this provides. Better default
219211 security is planned for the future.
220212
221-
222- Python and Django compatibility
223- -------------------------------
213+ ## Python and Django compatibility
224214
225215See [ ` ci.yml ` ] ( ./.github/workflows/ci.yml ) for which Python and Django versions this supports.
226216
227-
228- Demo Admin & Docker images
229- --------------------------
217+ ## Demo Admin & Docker images
230218
231219You can try the demo admin against several versions of Django with these Docker
232220images: https://hub.docker.com/r/crccheck/django-object-actions/tags
233221
234222This runs the example Django project in ` ./example_project ` based on the "polls"
235223tutorial. ` admin.py ` demos what you can do with this app.
236224
237-
238- Development
239- -----------
225+ ## Development
240226
241227Getting started:
242228
@@ -256,9 +242,7 @@ view the `Makefile` to see what other things you can do.
256242Some commands assume you are in the virtualenv. If you see
257243"ModuleNotFoundError"s, try running ` poetry shell ` first.
258244
259-
260- Similar Packages
261- ----------------
245+ ## Similar Packages
262246
263247If you want an actions menu for each row of your changelist, check out [ Django
264248Admin Row Actions] ( https://github.com/DjangoAdminHackers/django-admin-row-actions ) .
0 commit comments