def register(request): form = StartupRegistrationForm(request.POST or None, request.FILES or None) msg = None if form.is_valid(): form.save() msg = "Your startup was registered successfully. " return render_to_response( "resources/jobs/register.html", {"list": menu, "form": form, "msg": msg}, context_instance=RequestContext(request), )
def register_startup(request): try: if request.session['session_id']: user = get_object_or_404(User,email=request.session['session_id']) form = StartupRegistrationForm(request.POST or None, request.FILES or None) msg = None if form.is_valid(): startup = form.save(commit=False) startup.user = user startup.save() msg = 'Your startup was registered successfully. ' form = JobRegistrationForm() return render_to_response('resources/jobs/register_job.html', {'list':menu, 'form':form, 'msg':msg}, context_instance=RequestContext(request)) return render_to_response('resources/jobs/register_startup.html', {'list':menu, 'form':form, 'msg':msg}, context_instance=RequestContext(request)) except KeyError: pass return HttpResponseRedirect('/users/login?next=%s' % request.path)