Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tyler-Petrov opened this issue Jan 29, 2025 · 1 comment
Open

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

Tyler-Petrov opened this issue Jan 29, 2025 · 1 comment

Comments

@Tyler-Petrov
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants
@Tyler-Petrov and others