Changes between Initial Version and Version 1 of Ticket #27188, comment 9


Ignore:
Timestamp:
Oct 23, 2020, 6:22:54 AM (4 years ago)
Author:
Sultan

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27188, comment 9

    initial v1  
    11Why 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.
    22
    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.
     3I 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.
    44
     5It might be a good idea to reopen the discussion about this if you're interested.
     6
Back to Top