def submit_suggestion(request): if request.method == "POST": if request.POST['report']: if request.POST['type']: kind = request.POST['type'] else: kind = "" sugg = Suggestion(userfrom = request.user.get_profile(), body = request.POST['report'], kind = kind, submit_date = timezone.now()) sugg.save() url = request.GET.get('next','') if url: return HttpResponseRedirect(url) else: return HttpResponseRedirect(reverse('hip_engine.views.index'))
def give_feedback(request): if request.method == "POST": if request.POST['body']: if request.POST['kind']: kind = request.POST['kind'] else: kind = "" sugg = Suggestion(userfrom = request.user.get_profile(), body = request.POST['body'], kind = kind, submit_date = timezone.now()) sugg.save() if request.POST.get('next'): url_next = request.POST['next'] return HttpResponseRedirect(url_next) else: return HttpResponseRedirect(reverse('hip_engine.views.feed'))