Skip to content

error when tring to access a=children formset of a model #409

@kimutaiRop

Description

@kimutaiRop

I have a polymorphic model that I made and it has many child models which I want the users to be choosing dynamically, posting the first product has no issue, I was able to select the form to send to the user, however when I try subsequent queries for the model to send to user I get error

polymorphic.formsets.models.UnsupportedChildType: The 'ShirtsAndBlouseForm' found a 'PhoneTablets' model in the queryset, but no form class is registered to display it.
my forms look like this

PhonesTabsForm = polymorphic_modelformset_factory(Product, fields=product_fields, formset_children=(
    PolymorphicFormSetChild(PhoneTablets, fields=product_fields + ['screen_size', 'battery_type',
                                                                   'battery_capacity', 'ram_measure', 'ram_storage',
                                                                   'internal_storage']),
))
ShirtsAndBlouseForm = polymorphic_modelformset_factory(Product, fields=product_fields, formset_children=(
    PolymorphicFormSetChild(ShirtsAndBlouse, fields=product_fields + ['techniques',
                                                                      'fit_type', 'length', 'material', 'fabric_type',
                                                                      'wear_type', 'design'], ),
))

I dont understand what could be happening that it can allow me to select the form during the first time but not the second time when product exist in the database

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