tickets: 4345
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4345 | 2007-05-20 10:08:04 | 2016-09-06 18:30:36 | 2022-03-06 03:31:10.894427 | Accepted | closed | Database layer (models, ORM) | Bug | Normal | dev | fixed | FileField cannot be used with unique=True | The following model will result in an error in the (current) admin: {{{ #!python class Foo(Model): name = CharField(maxlength=50) file = FileField(upload_to="upload", unique=True) }}} When trying to add a Foo object in the admin, the following error occurs: {{{ ProgrammingError at /admin/browser/documentfile/add/ can't adapt Request Method: POST Request URL: http://localhost:8000/admin/browser/documentfile/add/ Exception Type: ProgrammingError Exception Value: can't adapt Exception Location: /django_src/django/db/backends/util.py in execute, line 12 }}} Removing unique=True from the file field makes it work -- but what will happen if a file with the same name is uploaded twice, attached to different objects? What will happen when either one is removed? | Gulopine | Fabian Fagerholm <fabbe@paniq.net> | fs-rf-fixed | 0 | 0 | 0 | 0 | 0 | 0 |