if you are using the old way of writting views, in the way of Function-Based-Views...
in your view, you are creating a new variable called usuario
to save the request.user probably...
but if you returning to the Template
a context_instance
, passing the value of the Context of the request, you will get the logged user, just by accessing the request
.
// In your views file
from django.shortcuts import render_to_response
from django.template import RequestContext
def your_view(request):
data = {
'formulario': Formulario()
# ...
}
return render_to_response('your_template.html',
data, context_instance=RequestContext(request))
// In your template
<form id='formulario' method='POST' action=''>
<h2>Publica tu tuit, {{ request.user.username.title }} </h2>
{% csrf_token %}
{{ formulario.as_p }}
<p><input type='submit' value='Confirmar' /></p>
</form>