django-loginas
django-loginas copied to clipboard
Add documentation for usage in templates
Is it something like this maybe:
<a class="sm" href="{% url 'loginas-user-login' user_id=other_user.id %}">login as</a>
This is useful, could you file a PR? I haven't touched the template code in a while.
actually this is what im doing, maybe I can add this
<a id="loginas-link" data-id="{{ u.pk }}" href="#">
log in as
</a>
<form data-loginas="{{ u.pk }}" method="post" id="loginas-form"
action="{% url 'loginas-user-login' u.id %}" style="display: none">
{% csrf_token %}
</form>
$('a[id="loginas-link"]').on('click', function () {
var id = $(this).data('id');
$('#loginas-form[data-loginas="' + id + '"]').submit();
});
This looks like it requires jQuery, though, which not everyone might load. If you have a template that works, its name, and its path, I can add it to the docs.