thanks for the update. So it seems, that save(commit=False) does not work here. What I try to do is:
create a track object without saving, because I need two more objects (Artist, Album). These two offers will be created out of the mp3 tags of the file, if there are any. I assign than those two opjects as foreign key to the Track object and than I call save. Do you think switching to signals may solve this problem? On 13 Mrz., 03:46, lucy <a.downy.h...@gmail.com> wrote: > Fixed. It turned out I was reading my error log wrong. It wasn't the > image field itself that was having trouble saving, but a pre_save > signal that attempted to open the image and create a thumbnail. Yeah, > instance.image.path doesn't exist yet. I moved that to a post_save > signal and everything works great. I'm not really sure how this worked > on the mac/sqlite3 combo. > > On Mar 12, 2:55 pm, lucy <a.downy.h...@gmail.com> wrote: > > > > > I have a similar problem in that upload_to is not being respected, > > even when saving. That is, the system tries to save the file directly > > in my MEDIA_ROOT folder, rather than the upload_to path. An error > > occurs, and the file does not appear to be saved anywhere. > > > It works fine on Mac OS X.4 with sqlite3, django r8970. > > > The problem occurs on ubuntu 8.04(lts) with postgresql 8.3, django > > r9999 (i tried different django versions). > > > The problem occurs with both dynamic (callable) upload_to and static > > (simple path) upload_to. Regardless of upload_to, the error is exactly > > the same. > > > If someone could help me redirect standard out to a log file with > > apache2/fastcgi then I could try to print something more useful. I'm > > having trouble debugging this. > > > L. > > > On Mar 7, 6:10 am, tom <thomas.st...@gmail.com> wrote: > > > > Unfortunatly I still haven't found a solution and I tryed it with and > > > without a trailing /. > > > No difference. > > > > I will post the solution, if there is one and if I find it. :) > > > > -Tom > > > > On 5 Mrz., 16:39, Francis <lav.fran...@gmail.com> wrote: > > > > > Did you found any solution? > > > > > Because I have the same problem, but on opposite side (works on mac > > > > but not on linux). > > > > > I think that you need a trailing "/" to your upload_to path though. > > > > > Francis > > > > > On Mar 1, 8:21 pm, tom <thomas.st...@gmail.com> wrote: > > > > > > here is some more information, maybe that helps. These are just > > > > > different lines of code from different files, but they actually > > > > > describe what's happening: > > > > > > settings.py > > > > > MEDIA_ROOT = '/Library/WebServer/Documents/media/indiebreed/' > > > > > > models.py > > > > > file = models.FileField(upload_to="tmp/tracks", max_length = 1000) > > > > > > json_views.py > > > > > if request.method == 'POST': > > > > > form = TrackForm(request.POST, request.FILES) > > > > > if form.is_valid(): > > > > > new_track = form.save(commit = False) > > > > > print new_track.file.path > > > > > > error: > > > > > IOError at /music/tracks/testupload/ > > > > > [Errno 2] No such file or directory: u'/Library/WebServer/Documents/ > > > > > media/indiebreed/03 Magical Box.mp3' > > > > > > actually the path should be like this: > > > > > /Library/WebServer/Documents/media/indiebreed/tmp/tracks/03 Magical > > > > > Box.mp3 > > > > > > any ideas? > > > > > ah, i am on a mac and it works under linux > > > > > > many thanks. > > > > > tom > > > > > > Path: . > > > > > URL:http://code.djangoproject.com/svn/django/trunk > > > > > Repository Root:http://code.djangoproject.com/svn > > > > > Repository UUID: bcc190cf-cafb-0310-a4f2-bffc1f526a37 > > > > > Revision: 9912 > > > > > Node Kind: directory > > > > > Schedule: normal > > > > > Last Changed Author: russellm > > > > > Last Changed Rev: 9911 > > > > > Last Changed Date: 2009-02-27 14:14:59 +0100 (Fr, 27 Feb 2009) > > > > > On 28 Feb., 01:47, tom <thomas.st...@gmail.com> wrote: > > > > > > > Hi, > > > > > > > I am somehow confused. I am using this in a model: > > > > > > file = models.FileField(upload_to="tmp/tracks/", max_length = 1000) > > > > > > > and than I am doing this in a form: > > > > > > new_track = form.save(commit = False) > > > > > > > after that I want to access the file to do some stuff with it, like > > > > > > print new_track.file.path > > > > > > > when I do this, the path to the file is without the extra path from > > > > > > "upload_to" in the model. how can I access the full path to the > > > > > > file? > > > > > > Or, where will the file be saved to, because it also does not exist > > > > > > within the "upload_to" dir. > > > > > > > Maybe it would be a solution to access the temp file, does someone > > > > > > know how to access the path string? > > > > > > > regards, tom --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---