I'd like to display 2 inline forms on the same page, which are
different filtered versions of the same table.

Screenshot of the page: 
http://static.mftransparency.org/media/misc/2-inline-filtered-formsets.png

I filter the queryset to limit the form to a subset of the table:

    class DisbursementProductFeesFormSet(BaseInlineFormSet):
        def get_queryset(self):
            return
ProductFees.objects.filter(product=self.instance).filter(assessedAt=1)

    class ContinuingProductFeesFormSet(BaseInlineFormSet):
       def get_queryset(self):
           return
ProductFees.objects.filter(product=self.instance).filter(assessedAt=2)

I am able to get the form to display using the following controller
code:

    ProductFeesFormSet = inlineformset_factory(Product, ProductFees,
formset=DisbursementProductFeesFormSet, extra=2, max_num=2)
    disbursementFeesFormset = ProductFeesFormSet(instance=data)

    ContinuingFormset = inlineformset_factory(Product, ProductFees,
formset= ContinuingProductFeesFormSet, extra=2, max_num=2)
    continuingFeesFormset = ContinuingFormset(instance=data)

But I have problems saving saving the forms individually, which I
theorize is because the fields on both forms are created with the same
field ids, as seen by this example for the description field:

  disbursement inline form:
    id_productfees_set-0-description

  continuing inline form:
    id_productfees_set-0-description

Is there a way that I can setup the two forms so that their field
names are different, or is there a better way to display two different
versions of the same table on the same form?

-Tim Langeman
Akron, PA

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to