﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4345	FileField cannot be used with unique=True	Fabian Fagerholm <fabbe@…>	Marty Alchin	"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?"	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed	fs-rf-fixed		Accepted	0	0	0	0	0	0
