#14911: Custom Storage System not working properly
---------------------------------------+------------------------------------
 Reporter:  jtheoof                    |       Owner:  nobody    
   Status:  new                        |   Milestone:  1.3       
Component:  File uploads/storage       |     Version:  1.2       
 Keywords:  storage ImageField Custom  |       Stage:  Unreviewed
Has_patch:  0                          |  
---------------------------------------+------------------------------------
 As described in django [http://docs.djangoproject.com/en/dev/topics/files/
 doc], it should be possible to override the default storage system.

 {{{
 from django.db import models
 from django.core.files.storage import FileSystemStorage

 fs = FileSystemStorage(location='/media/photos')

 class Car(models.Model):
     ...
     photo = models.ImageField(storage=fs)
 }}}

 Also, by default, the `DefaultStorage` is the `FileSystemStorage` in
 `django.core.files.storage`

 But specifying storage at model field level is rising an exception see
 this code:

 {{{
 import datetime

 from django.core.files.storage import FileSystemStorage
 from django.db import models

 class ModelTest(models.Model):
     image = models.ImageField(upload_to='test', storage=FileSystemStorage)
     date_created = models.DateTimeField(default=datetime.datetime.now)
 }}}

 I'm getting the following exception at view level:

 `unbound method get_valid_name() must be called with FileSystemStorage
 instance as first argument (got unicode instance instead)`

 when I try to upload a file in the admin interface.

 If I remove the `storage` parameter, it works fine.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14911>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to