Changes between Initial Version and Version 1 of Ticket #27188, comment 9
- Timestamp:
- Oct 23, 2020, 6:22:54 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #27188, comment 9
initial v1 1 1 Why not implement this with the `Model.validate_unique()` method? It was created precisely for this. It is already using resources for connecting to the database and checking that there is no duplication. 2 2 3 I think that before `Model.validate_unique()` is called, we need first to prepare the final `file.name` value by calling the `FileF Ield.generate_filename()` method. The most appropriate place to do this is in the `FileDescriptor.__set__` method, rather than in the `FieldFile.save()` method, which I prefer, so that it always only accepts the final filename.3 I think that before `Model.validate_unique()` is called, we need first to prepare the final `file.name` value by calling the `FileField.generate_filename()` method. The most appropriate place to do this is in the `FileDescriptor.__set__` method, rather than in the `FieldFile.save()` method, which I prefer, so that it always only accepts the final filename. 4 4 5 It might be a good idea to reopen the discussion about this if you're interested. 6