Example #1
0
File: views.py Project: NateWr/rua
def request_proposal_revisions(request, proposal_id):

	proposal = get_object_or_404(submission_models.Proposal, pk=proposal_id)
	email_text = models.Setting.objects.get(group__name='email', name='proposal_request_revisions')

	if request.POST:
		proposal.status = 'revisions_required'
		logic.close_active_reviews(proposal)
		logic.send_proposal_revisions(proposal, email_text=request.POST.get('revisions-email'), sender=request.user)
		proposal.save()
		return redirect(reverse('proposals'))

	template = 'core/proposals/revisions_proposal.html'
	context = {
		'proposal': proposal,
		'email_text': logic.setting_template_loader(setting=email_text,path="core/proposals/",pattern="email_template_",dictionary={'sender':request.user,'receiver':proposal.owner}),
	}

	return render(request, template, context)
Example #2
0
File: views.py Project: NateWr/rua
def accept_proposal(request, proposal_id):
	'Marks a proposal as accepted, creates a submission and emails the user'
	proposal = get_object_or_404(submission_models.Proposal, pk=proposal_id)
	email_text = models.Setting.objects.get(group__name='email', name='proposal_accept')

	if request.POST:
		proposal.status = 'accepted'
		logic.close_active_reviews(proposal)
		submission = logic.create_submission_from_proposal(proposal, proposal_type=request.POST.get('proposal-type'))
		attachment = handle_attachment(request, submission)
		logic.send_proposal_accept(proposal, email_text=request.POST.get('accept-email'), submission=submission, sender=request.user, attachment=attachment)
		proposal.save()
		return redirect(reverse('proposals'))

	template = 'core/proposals/accept_proposal.html'
	
	context = {
		'proposal': proposal,
		'email_text': logic.setting_template_loader(setting=email_text,path="core/proposals/",pattern="email_template_",dictionary={'sender':request.user,'receiver':proposal.owner}),
	}

	return render(request, template, context)