On Mon, Oct 3, 2011 at 10:30 AM, Victor Hooi <[email protected]> wrote:
> heya,
> @Shawn: Hmm, that looks like quite an interesting approach - so the
> ModelForm would handle the validation logic? =) Me likes! Haha.
> I can parse the CSV and get the field names to match up (or just do a simple
> transform to get them to match).
> However, how do I then pass this information into a ModelForm? Also, the CSV

You pass the dictionary in as the data kwarg -- the same place you'd
usually pass request.POST.

> file is for creating multiple models - one model per CSV line - how will
> that work with a single ModelForm? Do I just call it repeatedly?

Sure, in a loop

> And how will I then capture the ValidationError and get them back in my
> form?

If form.is_valid() is False, you can return form.errors.as_text() to your user.

> Cheers,
> Victor
>
> --
> 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/-/wT8cDUDW62IJ.
> 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.
>



-- 
Shawn Milochik

CTO
Greenphire

484-334-2752
[email protected]

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