1
0
mirror of https://github.com/django/django.git synced 2024-11-19 16:04:13 +00:00
django/tests/regressiontests/file_uploads/models.py
Jacob Kaplan-Moss 7899568e01 File storage refactoring, adding far more flexibility to Django's file handling. The new files.txt document has details of the new features.
This is a backwards-incompatible change; consult BackwardsIncompatibleChanges for details.

Fixes #3567, #3621, #4345, #5361, #5655, #7415.

Many thanks to Marty Alchin who did the vast majority of this work.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-08 20:59:02 +00:00

11 lines
339 B
Python

import tempfile
import os
from django.db import models
from django.core.files.storage import FileSystemStorage
temp_storage = FileSystemStorage(tempfile.mkdtemp())
UPLOAD_TO = os.path.join(temp_storage.location, 'test_upload')
class FileModel(models.Model):
testfile = models.FileField(storage=temp_storage, upload_to='test_upload')