Code

Opened 3 years ago

Closed 3 years ago

#14726 closed (invalid)

how to get an empty formset in a formwizard?

Reported by: hs4-mayer@… Owned by: nobody
Component: Forms Version: 1.2
Severity: Keywords: empty formset, formwizard,
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hi!

I've already spent a lot of time trying to get this to work, without success! I have a formwizard which includes a modelform and a modelformset which should be empty.

On the first page i display the form, on the second follows the modelformset, which should be empty and used to add new rows. But it always displays all available table rows.
I've already tried the following:

class BaseMyModelFormSet(BaseModelFormSet):

def init(self, *args, kwargs):

super(BaseMyModelFormSet, self).init(*args, kwargs)
self.queryset = MyModel2.objects.none()

In urls.py I did the following:
...
(r'...$', MyFormWizard([MyModelForm1, modelformset_factory(MyModel2, formset=BaseLVFormSet), MyModelForm3])), ...

But nothing changed... still all available rows are displayed in the modelformset.

After that I tried:

MyModel2FormSet = modelformset_factory(MyModel2)
formset = MyModel2FormSet(MyModel2.objects.none())

...
(r'...$', MyFormWizard([MyModelForm1, formset, MyModelForm3])), ...

Now I get an error message, which tells me that MyModel2FormFormSet isn't callable...

Does anyone know what I'm doing wrong? I'm grateful for every hint ;)

Greetings,
johnny

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by lukeplant

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

This bug tracker is not the right place for help requests - see the instructions at the top when filing a ticket.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.