> One idea would be to put 'fieldname' as the first parameter to the > function, then use functools.partial [1] to create partial functions > for each file field with the value set appropriately: > > thumbnail_image = FileField(upload_to=partial(get_upload_path, > 'thumbnail_image'))
Outstanding, thanks. I actually thought to myself "I need a decorator type thing that I can pass a value with but still have it behave like a callable" but didn't know about functools.partial. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.