#10121: ImageField (and FileField) loses data when re-saving from admin -------------------------------------------+-------------------------------- Reporter: Uninen | Owner: Status: new | Milestone: Component: django.contrib.admin | Version: SVN Resolution: | Keywords: admin, ImageField, save Stage: Accepted | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | -------------------------------------------+-------------------------------- Changes (by kmtracey):
* stage: Unreviewed => Accepted Comment: I've attached a patch that adds a test for this case, and a possible fix. The added test passes on 1.0 and the current 1.0.X branch, fails on current trunk, and passes with the fix. The fix is to simply restore the old `save_form_data` method override that existed in !FileField before r9766. I really have no idea if that is correct or appropriate, so review from someone with a clue in this area would be appreciated. (The entire test suite does pass with the restored `save_form_data` method, so if its removal was necessary for something added in r9766 that doesn't appear to be fully tested by the tests added there.) Once this is fixed, we're left with the situation that once you have set a value to a blank=True !FileField, there is no way with a vanilla !ModelForm to set it back to blank, since if you just don't supply a file in the POST data the old value is used. But that is the way things used to be and seems to be a lesser evil than requiring re-upload of existing files in order to edit any other field in a model instance without losing the file setting. (#7048 looks to cover being able to "re-blank" !FileFields in admin, but I don't know if the solution being investigated there provides a general answer for !ModelFields or if it is admin- specific.) -- Ticket URL: <http://code.djangoproject.com/ticket/10121#comment:12> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---