models.py 250 B

12345678910
  1. from django.db import models
  2. def handle_upload_to(instance, filename):
  3. return '{}/{}'.format(instance.uid, filename)
  4. class File(models.Model):
  5. uid = models.CharField(max_length=200)
  6. file = models.FileField(upload_to=handle_upload_to)