3
from django.db import models
4
from django.core.files.storage import FileSystemStorage
5
from django.forms import ModelForm
7
temp_storage = FileSystemStorage(tempfile.gettempdir())
9
class Photo(models.Model):
10
title = models.CharField(max_length=30)
11
image = models.FileField(storage=temp_storage, upload_to='tests')
13
# Support code for the tests; this keeps track of how many times save()
14
# gets called on each instance.
15
def __init__(self, *args, **kwargs):
16
super(Photo, self).__init__(*args, **kwargs)
19
def save(self, force_insert=False, force_update=False):
20
super(Photo, self).save(force_insert, force_update)
23
class PhotoForm(ModelForm):