Ticket #10041: 10041.diff

File 10041.diff, 1.1 KB (added by Marty Alchin, 16 years ago)

Updated the test to use a temporary directory, like other tests currently do.

  • tests/regressiontests/forms/models.py

     
    11# -*- coding: utf-8 -*-
    22import datetime
     3import tempfile
    34
    45from django.db import models
    56# Can't import as "forms" due to implementation details in the test suite (the
    67# current file is called "forms" and is already imported).
    78from django import forms as django_forms
     9from django.core.files.storage import FileSystemStorage
    810
     11temp_storage_location = tempfile.mkdtemp()
     12temp_storage = FileSystemStorage(location=temp_storage_location)
     13
    914class BoundaryModel(models.Model):
    1015    positive_integer = models.PositiveIntegerField(null=True, blank=True)
    1116
     
    1924    name = models.CharField(max_length=10)
    2025
    2126class FileModel(models.Model):
    22     file = models.FileField(upload_to='/')
     27    file = models.FileField(storage=temp_storage, upload_to='tests')
    2328
    2429class FileForm(django_forms.Form):
    2530    file1 = django_forms.FileField()
Back to Top