Exemple #1
0
def contact(request, toUserId):
    if request.method == 'POST' :
        form = ContactUserForm(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            context = getCommonContext(request)
            context.update({'message' : _(u'Your message has been sent')})
            return render_to_response('ncs/simple_message.html', context)
    else:        
        form = ContactUserForm()
        form.setInitial(request.user, User.objects.get(id=toUserId))
    return render_to_response("papershare/contact_form.html",
                              { 'form': form })
Exemple #2
0
def contactPaper(request, requestId):
    if request.method == 'POST' :
        form = ContactUserForm(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            context = getCommonContext(request)
            context.update({'message' : _(u'Your message has been sent')})
            return render_to_response('ncs/simple_message.html', context)
    else:        
        paperRequest = Request.objects.get(id=requestId)
       
        subject = _(u"Bài báo của bạn :" + paperRequest.paper.title) 
    #    subject = settings.EMAIL_HOST
        content = _(u"Chào bạn " + u"" + u",\n" \
                + u"Đây là bài báo mà tôi tìm được giúp bạn \n" \
                + u"Thân, \n" \
                + request.user.username) 
        form = ContactUserForm()
        form.setInitial(request.user, 
                        paperRequest.requester,
                        subject, content)
    return render_to_response("papershare/contact_form.html",
                              { 'form': form })