Hi Matt,

Search the docs for inlines, inline formsets and inline formset factories,
and you'll find exactly what you need [0].

Read them carefully cause it's easy to make mistakes and debugging inlines
has always been frustrating for me.

Good luck and happy coding.

Cheers,
AT

[0] https://docs.djangoproject.com/en/dev/topics/forms/modelforms/

On Apr 3, 201
>
> I'm working on a complex form and not sure if there is an elegant way to
> handle it in django.
>
> The form creates an invoice and it uses jQuery to dynamically add/remove
> extra form fields into the HTML for line items.  Each line item contains
> several fields including description, unit price, quantity etc.
>
> On the server I need to create all these line item objects and set the
> foreign key back to the invoice model object.  It needs to validate
> everything and return errors for the appropriate fields.
>
> I'd like to use a ModelForm or Form for the whole invoice but not sure how
> to represent the line item fields.
>
> Suggestions?
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/xaYRsc5sZxwJ.
> 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.
>

-- 
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