Could you just use a collection of forms with different prefixes
(which posted back via a hidden field generated by your script)?
add <input type=hidden name='form_prefixes' value=789> to each of your
element sets.
class RoomShared(Form):
room_type = IntegerField(widget=Select(choices=BEDROOM_TYPES))
room_price = IntegerField()
is_shared = BooleanField(required=False)
You'd have to change the html of your elements a bit, since you are
appending the identifier and prefix does the opposite.
name = "789-room_price" instead of name="room_price_789" for example
invalid=[]
valid[]
prefixes = request.POST.getlist('form_prefixes')
pforms={}
for p in prefixes:
pforms[p]=RoomShared(request.POST,prefix=p)
if pforms[p].is_valid():
valid.append(p)
else:
invalid.append(p)
do(stuff)
...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---