On Mar 26, 3:21 pm, IanSR <ijsto...@crystal.harvard.edu> wrote:
> I've spent the last few hours trying variations on upload_to for my
> FileField path generator get_file_path(instance,filename) that will
> allow me to include the username from the POST HttpRequest object.  No
> luck.  Does anyone have any suggestions on how to do this?  My
> instance does have a "user" field that saves the request.user ID (as a
> ForeignKey), however it appears that this is not yet available when
> the callback for upload_to is run.

It should be available. In your model definition, does the user
ForeignKey appear _before_ the file field? Make sure it does. If that
fails, can you describe what you mean by "No luck" above i.e. provide
more details of your custom upload_to callable?


-Rajesh D

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to