How can I get the username of the logged-in user in Django?
问题 How can I get information about the logged-in user in a Django application? For example: I need to know the username of the logged-in user to say who posted a Review: <form id='formulario' method='POST' action=''> <h2>Publica tu tuit, {{ usuario.username.title }} </h2> {% csrf_token %} {{formulario.as_p}} <p><input type='submit' value='Confirmar' /></p> </form> In usuario.username.title I get the username, but in the template, I need to get that information from the view. Thanks. =) 回答1: You