How to update the filename of a Django's FileField instance ?
        Posted  
        
            by pierre-guillaume-degans
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by pierre-guillaume-degans
        
        
        
        Published on 2010-03-30T15:45:43Z
        Indexed on 
            2010/03/30
            23:33 UTC
        
        
        Read the original article
        Hit count: 388
        
Hello,
Here a simple django model:
class SomeModel(models.Model):
    title = models.CharField(max_length=100)
    video = models.FileField(upload_to='video')
I would like to save any instance so that the video's file name would be a valid file name of the title.
For example, in the admin interface, I load a new instance with title "Lorem ipsum" and a video called "video.avi". The copy of the file on the server should be "Lorem Ipsum.avi" (or "Lorem_Ipsum.avi").
Thank you :)
© Stack Overflow or respective owner