How would I make a formset for exactly the # of images I have in a
queryset?

On Jul 26, 1:37 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Jul 26, 6:13 am, django user <djangou...@gmail.com> wrote:
>
>
>
> > I have a basic form with that shows user's uploaded images:
>
> > <form name="order" action="" method="POST">
> > <ul id="sortable" class="image_set">
> >     {% for photo in photos %}
> >     <li class="handle"><img src="{{ photo.image.url }}"
> > class="handle2" width="150" height="90" alt="test"></img>
> >         <div class="order"><label for="order" class="hidden">Order:</
> > label><input id="{{ photo.id }}" type="text" class="order_field"
> > value="{{ photo.position }}" name="image" /></div>
> > </li>
> >     {% endfor %}
> > </ul>
> >         <input type="submit" value="Submit" />
> >     </form>
>
> > I'm stuck trying to figure out how to get the post values for each
> > image in my view. I believe that I can do request.POST.getlist
> > ('image') but that will only get me a list of the "value" list and I
> > need to correlate each value(photo position) to the photo.id.
>
> > All help and advice is appreciated!!!
>
> Formsets would seem to be the way to go here. That would give you a
> separate form in the formset for each image, keeping all its
> information together. 
> See:http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#id1
> --
> DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to