コード例 #1
0
ファイル: views.py プロジェクト: cberner/hackercred
def create_comment(request):
    if request.method == "POST":
        form = PartialProjectForm(request.POST)
        if form.is_valid():
            data = form.clean()
            comment = Cred()
            comment.type = "COMMENT"
            comment.user = data['user']
            comment.added_by = request.user
            comment.text = data['text']
            comment.save()
            return HttpResponseRedirect(reverse(view_user, args=[data['user'].id]))
    else:
        return HttpResponseRedirect(reverse(index))
コード例 #2
0
ファイル: views.py プロジェクト: cberner/hackercred
def create_project(request):
    if request.method == "POST":
        form = PartialProjectForm(request.POST)
        if form.is_valid():
            data = form.clean()
            project = Cred()
            project.type = "PROJECT"
            project.user = data['user']
            project.external_url = data['external_url']
            project.added_by = request.user
            project.text = data['text']
            project.project_name = data['project_name']
            project.save()
            return HttpResponseRedirect(reverse(edit_profile))
    else:
        return HttpResponseRedirect(reverse(index))