Hi Tim, Thanks for the response.
My Test model: class Test(models.Model): text = models.CharField(max_length=50) image = models.ImageField(upload_to="upload/test_images/", blank=True, null=True) #also tried with FileField def __unicode__(self): return self.text class TestAdmin(admin.ModelAdmin): save_as = True admin.site.register(Test, TestAdmin) On 28/11/2009, at 2:43 PM, Tim Valenta wrote: > Does the newly created model lack a path entirely, or does it have a > path that points to a false location? In other words, is the right > path making it to the database, yet not to the filesystem to copy the > file? Also, since you didn't mention anything about it, I would > remind you that a proper test would include trying to make a change to > the FileField. If you don't try to change it, yet push "Save as new", > it won't be uploading the file again, so it won't be part of the list > of fields that it's manipulating. And that might be where the problem > lies. Could you confirm your suspicion from any playing around you > can do? > If you're sure that you really are setting it up for success yet it > fails anyway, you might consider overriding "save_model" on your > ModelAdmin, so that you can play with the values and see what's going > on: > > # ... in your ModelAdmin subclass > def save_model(self, request, obj, form, change): > super( **YourClassName**, self).save_model(self, request, > object, form, change) > > # Check if a file upload is present on this save request > if 'your_file_field_name' in request.FILES: > > # FileField object, already saved and > # migrated to the supposedly correct "upload_to" location > obj.your_file_field_name > > Hope that gets some cogs turning.. :) > > Tim The path on the saved as new file does not get saved, it doesn't even appear in request.POST: image="", and request.FILES is empty. If I remove blank=True from the definition, admin ask for the field to be filled out. If I submit a different file on the save as new, the new files gets saved no problems. I hope thats clear :-) Regard, Pawel. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.