Skip to content

Commit 37d56e1

Browse files
committed
doc using POST
1 parent 92ee519 commit 37d56e1

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ArticleAdmin(DjangoObjectActions, admin.ModelAdmin):
3232

3333
## Usage
3434

35-
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
3636
major difference is the functions for `django-object-actions` will take an
3737
object instance instead of a queryset (see _Re-using Admin Actions_ below).
3838

@@ -176,6 +176,24 @@ def get_change_actions(self, request, object_id, form_url):
176176

177177
The same is true for changelist actions with `get_changelist_actions`.
178178

179+
### Using POST instead of GET for actions
180+
181+
⚠️ This is a beta feature and subject to change
182+
183+
Since actions usually change data, for safety and semantics, it would be
184+
preferable that actions use a HTTP POST instead of a GET.
185+
186+
You can configure an action to only use POST with:
187+
188+
```python
189+
@action(methods=("post",), button_type="form")
190+
```
191+
192+
One caveat is Django's styling is pinned to anchor tags[^1], so to maintain visual
193+
consistency with other actions, we have to use anchor tags too.
194+
195+
[^1]: https://github.com/django/django/blob/826ef006681eae1e9b4bd0e4f18fa13713025cba/django/contrib/admin/static/admin/css/base.css#L786
196+
179197
### Alternate Installation
180198

181199
You don't have to add this to `INSTALLED_APPS`, all you need to to do

0 commit comments

Comments
 (0)