mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #7712, #9404, #10249, #10300: a light refactor and cleanup of file storage and the File object. Thanks to Armin Ronacher and Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -6,6 +6,7 @@ and where files should be stored.
|
||||
"""
|
||||
|
||||
import shutil
|
||||
import random
|
||||
import tempfile
|
||||
from django.db import models
|
||||
from django.core.files.base import ContentFile
|
||||
@@ -26,7 +27,6 @@ class Storage(models.Model):
|
||||
def random_upload_to(self, filename):
|
||||
# This returns a different result each time,
|
||||
# to make sure it only gets called once.
|
||||
import random
|
||||
return '%s/%s' % (random.randint(100, 999), filename)
|
||||
|
||||
normal = models.FileField(storage=temp_storage, upload_to='tests')
|
||||
|
||||
Reference in New Issue
Block a user