def path_and_renamecsv(instance, filename): upload_to = 'attendancesheet' ext = filename.split('.')[-1] # get filename if instance.pk: filename = '{}.{}'.format(instance.pk, ext) else: # set filename as random string filename = '{}.{}'.format(uuid4().hexq, ext) # return the whole path to the file return os.path.join(upload_to, filename)
-- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cc8c6fbc-2d66-49eb-80c5-4e8b85d66e34n%40googlegroups.com.