Beispiel #1
0
def componer(request):

	if request.method == 'POST':
		form = CorreoForm(request.POST)
		if form.is_valid():
			m = Mensaje(remitente = Usuario(request.user), receptor = request.POST['receptor'],
					asunto = request.POST['asunto'],
					texto = request.POST['texto'],
					fecha = date.today())
			m.save()
			return rHttpResponseRedirect(url('correos.views.index'))					
	else:
		form = CorreoForm()
	
	return render_to_response('correos/componer.html', {'form': form}, context_instance=RequestContext(request))
Beispiel #2
0
def componer(request):

	if request.method == 'POST':
		form = CorreoForm(request.POST)
		if form.is_valid():
			m = Mensaje(remitente = Usuario.objects.get(user = request.user),
					asunto = request.POST['asunto'],
					texto = request.POST['texto'],
					fecha = date.today())
			m.save()
			m.receptor.add(Usuario.objects.get(user = User.objects.get(username = request.POST['receptor'])))
			m.save()
			return HttpResponseRedirect('/buzon')					
	else:
		form = CorreoForm()
	
	return render_to_response('correos/componer.html', {'form': form}, context_instance=RequestContext(request))