예제 #1
0
파일: views.py 프로젝트: do3cc/Ueberblick
def add_project(request):
    retval = {"body_id": "add_project"}
    if "submit" in request.POST:
        controls = request.POST.items()
        try:
            appstruct = Form(forms.project).validate(controls)
        except ValidationFailure, e:
            retval.update({"form": e.render()})
            return retval
        appstruct["address_id"] = appstruct.pop("address")
        DBSession.add(Project(**appstruct))
        retval.update({"form": "Success"})
        return retval