Django-jazzmin - Logout

I’ve installed Django Jazzmin by following the instructions provided at Installation - Jazzmin. However, I’m encountering an issue when accessing my admin panel. I can log in successfully, but upon logging out, I encounter the following error:

[13/Dec/2023 01:46:18] "GET /admin/logout/ HTTP/1.1" 405 0

I’ve learned from the forum that using GET to log out from Django is deprecated. I’m currently using Django 5.0, and I attempted to resolve the issue by uninstalling Jazzmin. After doing so, I can log out successfully, and the following message is displayed:

[13/Dec/2023 01:55:46] "POST /admin/logout/ HTTP/1.1" 200 3553

However, I would like to continue using Django Jazzmin. Unfortunately, the error persists when I reinstall it, and I’m unsure how to address it. I suspect it might be a misconfiguration in Django Jazzmin. Any ideas or suggestions would be greatly appreciated.

The details at django-jazzmin · PyPI show that it’s only tested up through Django 3.1, and hasn’t published an update in more than a year.

If you want to use it with a more current version, you’ll either need to find a fork of it that has been upgraded, or fork and upgrade it yourself.

1 Like

Wow i missed that. Thanks a lot Ken.

I encountered the same issue and improved the problem encountered with GET logout through the following method.

modify it

<!-- Django 4.1 only supports POST for logout. -->
<form action="{% url 'admin:logout' %}" method="post">
    {% csrf_token %}
    <button type="submit" class="dropdown-item">
        <i class="fas fa-users mr-2"></i> {% trans 'Log out' %}
    </button>
</form>
2 Likes

I can confirm that @geminixiang fix is working. can you please make the change in the base code?
@KenWhitesell FYI. we are working on django 5.X and Jazzmin working fine for us.

1 Like

@idan-krayon I think it’s up to all django eco-system applications to adapt to django, not the other way around.
You can defend the question here

Massive thanks! , I’ve been wrestling with this issue for over an hour, and your solution helped me successfully navigate around it.

Plus, the solution is quite straightforward, however, I’m curious why the base code hasn’t been updated. Do you foresee any potential issues for users on Django 4.x if this remains unchanged?

how can i access it, i am using virtual env

you can access it in the following path : your_virtual_env\Lib\site-packages\jazzmin\templates\admin

I have Django 5.0, and even after replacing this element, I am still encountering the same issue (error 405). What should I do in this case?

what about views ? since it is basically just template, i need the user to be actually logged out?

did u solve that issue?

this problem has been definitively solved and merged here