Rik/affiliates — comment on commit 9f569fa9ad3f3e16ee13522be2e0b00cd3627bad
File: apps/banners/models.py line 31
By Osmose:

I tested this on my machine and it produced the filename 'None.png' every time, because the instance is not saved before this is called: https://docs.djangoproject.com/en/1.3/ref/models/fields/#django.db.models.FileField.upload_to

I'm thinking something like this might work:

```python
def rename(instance, filename):
props = '_'.join(instance.banner_id, instance.color, instance.locale)
name = hashlib.sha1(props).hexdigest()
extension = os.path.splitext(filename)[1]
format = '%s%s' % (name, extension)
return os.path.join(settings.BANNER_IMAGE_PATH, format)
```

Thoughts?