jazzband / django-formtools

A set of high-level abstractions for Django forms
https://django-formtools.readthedocs.io
BSD 3-Clause "New" or "Revised" License
814 stars 136 forks source link

Form initial data #100

Closed fchevitarese closed 7 years ago

fchevitarese commented 7 years ago

Hi there! First, i would like to be sure it's a bug, so i'm asking here first.

I'm using formtools to make a confirmation to my submit. So my modelform have a method with a ChoiceField that queries the database with a given code in the url and fill the combobox.

So, to make it work, i have to call get_initial and pass the data. After i post, the form is invalid because, when it validates, there's no data anymore.

And the post have the same behaviour.

Putting form = self.form(request.POST, auto_id=self.get_auto_id(), initial=self.get_initial(request)) in the code for both cases, make it work.

It's a thing that should be in the code, or i should override those methods?

Thanks in advance!