Django

Code

Show
Ignore:
Timestamp:
08/08/08 15:59:02 (5 months ago)
Author:
jacob
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/bug639/models.py

    r5876 r8244  
    11import tempfile 
     2 
    23from django.db import models 
     4from django.core.files.storage import FileSystemStorage 
     5 
     6temp_storage = FileSystemStorage(tempfile.gettempdir()) 
    37 
    48class Photo(models.Model): 
    59    title = models.CharField(max_length=30) 
    6     image = models.FileField(upload_to=tempfile.gettempdir()
     10    image = models.FileField(storage=temp_storage, upload_to='tests'
    711     
    812    # Support code for the tests; this keeps track of how many times save() gets 
    913    # called on each instance. 
    1014    def __init__(self, *args, **kwargs): 
    11        super(Photo, self).__init__(*args, **kwargs) 
    12        self._savecount = 0 
     15        super(Photo, self).__init__(*args, **kwargs) 
     16        self._savecount = 0 
    1317     
    1418    def save(self): 
    1519        super(Photo, self).save() 
    16         self._savecount +=
     20        self._savecount +=