On May 22, 1:08 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> Of more interest than the html printed for the form would be the code you
> use to create the form, and the template you use to display the form.
> Without those it is hard to guess what is going wrong.

Thanks for responding, Karen.

Here's the code that creates the form:

def create_payment_transaction_form(inventory_transaction, pay_all,
data=None):
    order = 'None'
    if inventory_transaction.order_item:
        order = ':
'.join([str(inventory_transaction.order_item.order.id),
inventory_transaction.order_item.order.customer.short_name])
    if pay_all:
        paid = True
    else:
        paid = not not inventory_transaction.payment
    return PaymentTransactionForm(data,
prefix=inventory_transaction.id, initial={
        'transaction_id': inventory_transaction.id,
        'transaction_type': inventory_transaction.transaction_type,
        'order': order,
        'product':
inventory_transaction.inventory_item.product.short_name,
        'transaction_date': inventory_transaction.transaction_date,
        'quantity': inventory_transaction.quantity,
        'amount_due': inventory_transaction.due_to_producer(),
        'paid': paid,
        })

Here's the relevant section of the template that displays a table full
of the forms.  The section at the end is temporary, to display any
field error messages (of which there are none).

{% for item_form in item_forms %}
     <tr>
        <td class="read-only-td" > {{ item_form.transaction_type }} </
td>
        <td class="read-only-td" > {{ item_form.order }} </td>
        <td class="read-only-td" > {{ item_form.product }} </td>
        <td class="read-only-td" > {{ item_form.transaction_date }} </
td>
        <td class="read-only-td" > {{ item_form.quantity }} </td>
        <td class="read-only-td" > {{ item_form.amount_due }} </td>
        <td> {{ item_form.paid }} </td>
                {{ item_form.transaction_id}}
    </tr>
        {% for field in item_form %}
                <tr>
                        <td colspan='6' >
                                {{ field.label_tag }}
                                {% if field.errors %} {{ field.errors }} {% 
endif %}
                        </td>
                </tr>
        {% endfor %}
{% endfor %}

Does that help with diagnosis?  Anything else that would clarify the
situation?
--~--~---------~--~----~------------~-------~--~----~
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