django-simple-menu icon indicating copy to clipboard operation
django-simple-menu copied to clipboard

Add support for POST instead of GET requests on clicking menu items.

Open dylanhillier opened this issue 9 months ago • 0 comments

I would like to add a logout/sign out menu item which requires the request to be a POST instead of a get. This is in light of this change: https://code.djangoproject.com/ticket/15619

For example, something like:

Menu.add_item(
    "user",
    MenuItem(
        profile_title,
        reverse("logout"),
        post_request=True,  # <<<<<<<< new arg.
        icon="box-arrow-right"
    ),
)

Then instead of generating a <a href=xxxx /> it generates a <form method="post" .... </form>

If there is an existing clean way of doing this i would also be interested.

dylanhillier avatar May 08 '24 09:05 dylanhillier