I get rendered
<label for="id_authorizedpickupperson_set-0-id">Id</label> also
<label for="id_authorizedpickupperson_set-0-user">User</label>
### The mostly relevent part of views.py:
from django.forms.models import inlineformset_factory
@login_required
def pickup(request):
try:
profile = request.user.get_profile()
except:
return HttpResponseRedirect('/profile/')
PickUpFormSet = inlineformset_factory(UserProfile,
AuthorizedPickUpPerson, max_num=5, fields=('name', 'relationship',
'phone'))
if request.method == "POST":
formset = PickUpFormSet(request.POST, instance=profile )
if formset.is_valid():
instances = formset.save(commit=False)
for instance in instances:
instance.user = profile()
instance.save()
return HttpResponseRedirect('/')
else:
formset = PickUpFormSet(instance=profile, )
context = {'formset':formset, 'profile':profile,}
return render_to_response('pickup.html', context,
context_instance=RequestContext(request))
###Rendering to this template:
<form method="POST" action="/pickup/">
{{ formset.management_form }}
{% for form in formset.forms %}
{% for field in form %}
{{ field.label_tag }}: {{ field }} </br>
{% if field.help_text %}
{{ field.help_text }}{% endif %}
{% if field.errors %}{{ field.errors }}{% endif %}
{% endfor %}
{% endfor %}
<input type="submit" value="Update">
</form>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---