Hello, I have a model with a FileField. When using the MyModel.AddManipulator() in the view, everything works as expected.
But I need a custom manipulator. I've already made some custom manipulators that works pretty well, so I'm sure I'm not too wrong here. The one that don"t works is the one that need to save an uploaded file. Here it is: class CsvDataManipulator(forms.Manipulator): def __init__(self, pk=None): if pk: self.original_object = CsvData.objects.get(id=pk) self.pk = pk else: self.original_object = None self.pk = None self.fields = ( forms.FileUploadField(field_name='csv_file', is_required=False), forms.TextField(field_name='csv_sep', is_required=True, maxlength=1), ) def save(self, new_data): if self.original_object: temp = dict( csv_file=new_data['csv_file'], csv_sep=new_data['csv_sep'] ) for k,v in temp.iteritems(): self.original_object.__setattr__(k, v) self.original_object.save() return CsvData.objects.get(id=pk) else: temp = CsvData( csv_file=new_data['csv_file'], csv_sep=new_data['csv_sep'] ) temp.save() return temp In the view, it's used like this: ... manipulator = CsvDataManipulator() new_data = request.POST.copy() if request.FILES: new_data.update(request.FILES) errors = manipulator.get_validation_errors(new_data) Then i have an error that show that new_data['csv_file'] hold the content of the uploaded file: Any help welcome. Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---