As the crud controller updates the entity values with the new provided ones it is the expected behavior to se a file to empty if none is provided.
It might not be a good solution if you have huge files, but you can try to use the FileUploadKeeper validator which gets back the current value and submits it again. I never tried to use it with the crud controller anyway, so it might need some manual tuning to make it work. On Tue, Mar 20, 2012 at 1:39 PM, Moritz Schlarb <[email protected]> wrote: > Hello at all! > > I'm trying to customize tgext.admin to the needs of my application: > Since I have some PickleType columns in my model that should only be filled > by uploading plain files, I created the following form: > > class TestEditForm(EditableForm): > __model__ = Test > __require_fields__ = ['type'] > __omit_fields__ = ['id', 'assignment_id'] > __field_order__ = ['assignment', 'type', 'visible', 'timeout', > 'argv', 'input', 'output'] > > input = FileField(id='input', > validator=FieldStorageUploadConverter(not_empty=False)) > output = > FileField(id='output',validator=FieldStorageUploadConverter(not_empty=False)) > > which is included via > > class TestCrudConfig(CrudRestControllerConfig): > edit_form_type = TestEditForm > > and > > class MyAdminConfig(AdminConfig): > test = TestCrudConfig > > Now if there is already data in the input/output columns, it just gets > overwritten with None if the file isn't uploaded again. > > Am I missing a parameter to accomplish this non-overwriting behaviour? > Or could someone tell me some hackish way to achieve this! > > Thanks a lot, > Moritz > > -- > You received this message because you are subscribed to the Google Groups > "TurboGears" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/turbogears/-/pgDiN4rGcP0J. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/turbogears?hl=en. -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

