Some progress on my side...
Ok now I understand that doing this in the manipulator
save() method is not
going to help:
new_object = Attachment(file=new_data['upload']) # I got it
wrong...
Following the code of AutomaticManipulator, my save() method
now looks like:
new_object = Attachment(file=new_data['upload']['filename'])
new_object.save()
new_object.save_file_file(...)
In other words, I guessed that I have to create the object
first, assign the
filename to the FileField, save the object, THEN save the
real file.
Am I correct? Because if I am, I have some more questions:
* what is the correct method to save the file?
--> I see object.save_FIELD_file(...) will work, but I
am not sure about the
parameters.
--> There is also a field.save_file(...) in my
manipulator (I checked the code
in AutomaticManipulator save method as well), but this looks
like black magic
and again, I don't know about the parameters (off-topic:
this is the place
where doc string could help)
* how do I represent my manipulator fields in the html
template? Following the
documentation, I wrote {{ form.upload }} and
{{form.upload_file }} but the
latter statement does not appear when I look at the
generated HTML source code.
* in my new_data MultiValueDict, the value of 'upload' (i.e
my manipulator only
field) is represented as an array of only one value, but I
have only one field
named 'upload' in my template. Any idea?
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|