[Answer]-Django โ€“ Usecases for Formset and Inline Formset?

1๐Ÿ‘

โœ…

Inline formsets is a small abstraction layer on top of model formsets. These simplify the case of working with related objects via a foreign key.

It seems that inline formsets are exactly what you want.
Optionally you can specify how many DeliveryRequestBikes you want to allow for a DeliveryRequests.

Give them a try with:

from django.forms.models import inlineformset_factory
DeliveryRequestBikesFormSet = inlineformset_factory(DeliveryRequests, DeliveryRequestBikes, fk_name="deliveryrequest")
๐Ÿ‘คandrea.ge

Leave a comment