Strange in that it used to work and now doesn't. Unfortunately I only
use it about twice a year, so I'm not sure when it stopped.

Basically, I'm trying to upload a csv and save the fields to the
database:

class SpecialEvent(models.Model):
   ...
   results_csv = models.FileField(upload_to='files/events/special/
results/', blank=True, null=True)
   ...
   def save(self):
                if self.id is not None:
                        old_self = self.__class__.objects.get(id = self.id)
                        if self.results_csv and (self.results_csv.name !=
old_self.results_csv.name):
                                for i, line in 
enumerate(open(self.results_csv.name)):
                                        [do stuff]

                super(SpecialEvent, self).save() # Call the "real" save() 
method.

I'm getting an IOError: [Errno 2] No such file or directory: u'files/
events/special/results/utcc-results____.csv'

When I look in the directory, I see the file. Is it not there yet when
it's trying to open it? Should I maybe use a post save signal or
something instead?

--~--~---------~--~----~------------~-------~--~----~
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