def unitRequest(request): if request.method == "GET": return HttpResponseRedirect("/") elif request.method == "POST": form = UnitRequestForm(request.POST, scout=request.user) if form.is_valid(): req = form.save() req.notify() else: return userhome(request, request_form=form) return userhome(request)
def unitInvite(request): email = request.REQUEST.get('email') if email: form = UnitRequestForm({'member':request.user.profile.id, 'email':email, 'type':'invite', 'unit':request.user.profile.unit.id}) if form.is_valid(): req = form.save() req.notify() else: print form._errors return HttpJsonFailure("Doh! failed") return HttpJsonSuccess()