I've been trying to update some existing code to use newforms.
My initial experiment substituting a newforms produced form for a form
created by a custom manipulator worked fine.
However, I ran into some difficulty attempting to use a
form_for_instance produced form to substitute for a changemanipulator.

Teardown is the model I am trying to update.
TeardownPart is a model with a foreign key referencing a Teardown.

Using a change manipulator my template was able to access a set of
teardownparts from the form (see template excerpt below).
When I created a new view using newforms, I attempted to use the same
template, and found that the form.teardownpart did not seem to exist.

Is there something one has to do differently, either in the template
or the view, to preserve this functionality when switching to
newforms?

Thank you,

-Philip Barkow

Excerpted from original view:
        manipulator = Teardown.ChangeManipulator(teardown_id)
        form = forms.FormWrapper(manipulator, new_data, errors)


Excerpted from newforms view:
        teardown = Teardown.objects.get(id=teardown_id)
        TeardownForm = newforms.models.form_for_instance(teardown)
        form = TeardownForm()

Excerpted from template:
  {% for teardownpart in form.teardownpart %}
    <label for="id_teardownpart.{{ forloop.counter0 }}.part">Part:</
label> {{ teardownpart.part }}
        {% if teardownpart.errors %}
           <span class="error">*** {{ teardownpart.errors|join:",
" }}</span>
        {% endif %}
  {% endfor %}


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to