Let's suppose the following customs manipulator:
###########
class OrderManipulator(formfields.Manipulator):
        def __init__(self, basket_items=[]):
                # First we store the IDs passed as we'll need them for the save
method.
                self.items = basket_items
                # Now we need to         construct all of the fields which will 
make up our
form
                new_fields = []
                for item in basket_items:
                        # We need to add all of the appropriate fields along 
with the
additional ID field
                        # as detailed in the forum post
                        new_fields.append(formfields.TextField(field_name="%s" 
% item,
maxlength=15))
                        
new_fields.append(formfields.TextField(field_name="%s_Name" % item,
maxlength=100))
                        
new_fields.append(formfields.TextField(field_name="%s_Description" %
item))
                        
new_fields.append(formfields.IntegerField(field_name="%s_Price" %
item, maxlength=6))
                        
new_fields.append(formfields.IntegerField(field_name="%s_Vat" %
item, maxlength=4))
                        
new_fields.append(formfields.IntegerField(field_name="%s_Pieces" %
item, maxlength=6))
                        
new_fields.append(formfields.DatetimeField(field_name="%s_Date" %
item))
                        # The User field is ommited as we don't want it being 
changed.
                self.fields = new_fields
                print self.fields

        def save(self, new_data):
                for item in self.items:
                        temp = Order(
                        Name=new_data["%s_Name" % item],
                        Description=new_data["%s_Description" % item],
                        Price=new_data["%s_Price" % item],
                        Vat=new_data["%s_Vat" % item],
                        Pieces=new_data["%s_Pieces" % item],
                        Date=new_data["%s_Date" % item],
                        orderkey=new_data["%s_orderkey" % item]
                        )
                        temp.save()
                return temp

#####################


Is it possible to use that manipulator as ChangeManipulator?
How populate a form with the correct (multiple values) data?
The form should be a basket form when doing shoping and a user can
change/delete items from his basket.

Thanks for help
L.


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

Reply via email to