def prepare_invitations(request): logging.info(request.POST) job_id = request.POST['job_id'] job = Job.get_by_id(int(job_id)) job.start() job.save() student_ids = request.POST.getlist('student_ids') owner = request.POST['owner'] mode = request.POST['mode'] addressing_parents = request.POST['addressing_parents'] addressing_p = request.POST['addressing_p'] addressing_s = request.POST['addressing_s'] addressing_d = request.POST['addressing_d'] inflector.init_dicts() logging.info('student list %s'%student_ids) for student_id in student_ids: try: prepare_invitation(owner, student_id, mode,addressing_parents, addressing_p, addressing_s, addressing_d) except: logging.info("can't prepare invitation") job.finish() job.save() return HttpResponse('ok')
def test(request): inflector.init_dicts() if request.method == 'POST': form = TestInflectForm(request.POST) if form.is_valid(): pattern = form.cleaned_data['pattern'] part = form.cleaned_data['part'] gender = form.cleaned_data['gender'] proposal = inflector.do_inflect(part,gender,pattern) form = TestInflectForm({'proposal':proposal,'pattern':pattern,'gender':gender,'part':part}) else: form = TestInflectForm() return render_to_response('admin/inflects_test.html', RequestContext(request, {'form':form}))