d-demirci / django-adminlte3

AdminLTE Templates, Template Tags, and Admin Theme for Django
https://django-adminlte3.herokuapp.com/admin
Other
244 stars 111 forks source link

logout not found #19

Closed afrizal423 closed 3 years ago

afrizal423 commented 4 years ago

https://github.com/d-demirci/django-adminlte3/blob/bf7bcca0aeb67070c873858d936f74485cb5ebe7/adminlte3_theme/templates/admin/lib/_main_header.html#L40

please change with this {% url 'admin:logout' %}

deepanshu-nickelfox commented 3 years ago

if you are using Django add this line in settings.py

BASE_URL = http://127.0.0.1:8000/ LOGOUT_REDIRECT_URL = BASE_URL

kristingreen commented 3 years ago

The above suggestion doesn't work but this does...

LOGOUT_URL = '/admin/logout/'

PR #22 updates the logout_url tag to look for this in the settings file and to default to /admin/logout/ if it's not found

@register.simple_tag()
def logout_url():
    return getattr(settings, 'LOGOUT_URL', '/admin/logout/')

... but it's not defaulting as expected.

It stands to reason that since the actual Django admin uses this...

<a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a>

... @afrizal423's suggestion should be considered.

kristingreen commented 3 years ago

I would like to retract my assertion above that states that the code merged in PR #22 doesn't work. I forked and cloned a fresh copy of the repo and the logout now seems to work as intended. It must have been an issue with my local environment.