I am using the model with FileField to deal with file uploading. Now the files can be uploaded successfully. However, there is one more small improvement I want to make, which i
Instead of a string try passing a function:
def generate_filename(self, filename): url = "files/users/%s/%s" % (self.user.username, filename) return url class UserFiles(models.Model): user = models.OneToOneField(User) file = models.FileField(upload_to=generate_filename)