Hi Javier

Thanks for your reply.

I have modified my view like this:

def companyedit(request, pk):
    if request.method == 'POST':
        a = Company.objects.select_related().get(pk=pk)

        form = CompanyForm(request.POST, instance=a)
        if form.is_valid():

            form.save()
    else:
        company = get_object_or_404(Company, pk=pk)
        form = CompanyForm(instance=company)

    variables = RequestContext(request, {
        'form': form,
        'company': a
    })
    return render_to_response('contacts/update_company.html',
variables)

I had imagined therefore I would be able to iterate through the
Person's that belong to the Company using the following syntax:

{% for p in person %}
        {{ p.first_name }}
{% endfor %}

But I'm told that the company object is not iterable. Neither can I
just do company.first_name to get a person's name.

Thanks again for any assistance you can offer me.

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