title: Hooking between file uploaded and before model saved
body: <p>I'm new to django and try to realize an project that allows the user to upload a file, parses it and enters the contained information into the same model:</p>
  
  <pre><code>class Track(models.Model):  
      Gpxfile  = models.FileField("GPS XML", upload_to="tracks/gps/")
      date=models.DateTimeField(blank=True)
      waypoints = models.ForeignKey(Waypoint)
      ...
  </code></pre>
  
  <p>For the start I'm ok to work with the admin interface and to save work. So I hooked into the models save() method:</p>
  
  <pre><code>def save(self, *args, **kwargs):
      """we hook to analyse the XML files"""
      super(Track, self).save(*args, **kwargs) #get the GPX file saved first
      self.__parseGPSfile(self.Gpsxmlfile.path) #then analyse it
  </code></pre>
  
  <p>But here I run into <strong>problems due to the dependency</strong>:</p>
  
  <ul>
  <li>to get the filefield saved to a real file, I need to invoke the original save() first<br>
  <ul>
  <li>this breaks as some fields aren't populated yet as I didn't</li>
  </ul></li>
  <li>if I switch both lines, the file isn't saved yet and can't be parsed</li>
  </ul>
  
  <p>Maybe I have just a lack of basic knowledge but even after reading a lot of SOs, blogs and googeling around, I don't have a clear idea how to solve it. I just found this ideas that don't seem to fit very well:</p>
  
  <ul>
  <li>create your own view and connect it to your handler (<a href="https://djangosnippets.org/snippets/1036/" rel="nofollow">see here</a>)
  <ul>
  <li>bad as this won't work with admin interface, needs views, puts logic to views etc...</li>
  </ul></li>
  <li>use a validator for the filefield (<a href="http://jeremyaldrich.net/django-filefield-csv-validation/" rel="nofollow">see here</a>)
  <ul>
  <li>not sure if this is a good design, as it's about file processing in general and not realy validating (yet)</li>
  </ul></li>
  </ul>
  
  <p>So what does the community suggest to realize a file postprocessing and data "import" in Django 1.4?</p>