Skip to content

FieldList.last_index isn't reset in the .process() method #874

@Tyler-Petrov

Description

@Tyler-Petrov

In the FieldList.proccess() method the .entries property is set to an empty string, but .last_index isn't reset to -1. I'm assuming this isn't correct. This would be line 71 in fields/list.py.

In my code I need to call FieldList.process() multiple times, and that messes with what's stored in the entries list.

Here's some pseudo code to get the idea across:

class NameForm(Form):
    first = StringField()
    last = StringField()


class UserForm(Form):

    test_forms = FieldList(FormField(NameForm), min_entries=3)


user_form = UserForm()

# These lead to .last_index and .entries not being synced
user_form.test_forms.process(...)
user_form.test_forms.process(...)
user_form.test_forms.process(...)

Love the module by the way! It's really my bread and butter.

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