Skip to content

Handling Disabled & Readonly Fields #217

@pawl

Description

@pawl

Currently, if you create a field with {{ form.myfield(readonly=true) }} or {{ form.myfield(disabled=true) }} you still need to do this to prevent the disabled/readonly fields from getting saved:

def edit_team():
    form = TeamForm(request.POST, obj=team)
    del form.myfield
    if request.POST and form.validate():
        form.populate_obj(team)
        return redirect('/teams')
    return render('edit_team.html')

Would it cause any problems if WTForms deleted disabled/readonly fields from the form by default (to improve security)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions