﻿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
9508	FieldFile should define __hash__	Graham King	nobody	"FieldFile defines !__eq!__ to compare on the ''name'' field, but does not define !__hash!__, hence two FieldFile will be equal but have a different hash. Example:

{{{
from django.db.models.fields.files import FileField, FieldFile

f = FileField(upload_to='dir')
ff1 = FieldFile(None, f, 'dir/file.ext')
ff2 = FieldFile(None, f, 'dir/file.ext')

print 'Equal?', ff1 == ff2
print 'Hashes are equal?', hash(ff1) == hash(ff2)
}}}

I suggest adding the following to FieldFile:

{{{
def __hash__(self):
    return hash(self.name)
}}}

I haven't attached a patch because the change is only two lines - I'm happy too if requested.

I noticed this because I'm comparing objects in different databases by comparing the hash of each of their fields.
"		closed	File uploads/storage	1.0		fixed	FieldFile hash		Accepted	0	0	0	0	0	0
