示例#1
0
文件: views.py 项目: neithere/orgtool
def add_need(request):
    db = default_storage()

    ###
    import wtforms
#    from doqu.ext.forms import document_form_factory
#    BaseNeedForm = document_form_factory(Need, storage=db)
    class NeedForm(wtforms.Form):
        summary = wtforms.TextField('summary')
        stakeholders = wtforms.FieldList(wtforms.TextField('stakeholders'),
            min_entries=1)

    ###

    form = NeedForm(request.values)
    if request.method == 'POST':
        form = NeedForm(request.values)
        if form.validate():
            obj = Need()
            form.populate_obj(obj)
            obj.save(db)
            return redirect_to('needs.need', pk=obj.pk)
    return {'form': form}
示例#2
0
文件: views.py 项目: neithere/orgtool
def need_index(request):
    db = default_storage()
    needs = Need.objects(db).order_by('summary')
    return {
        'object_list': needs,
    }