1
0
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:
Jacob Kaplan-Moss
2009-05-08 15:08:09 +00:00
parent 2af75b485d
commit 68a890e79f
7 changed files with 107 additions and 139 deletions

View File

@@ -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')