﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22337	makemigrations not working when Field takes FileSystemStorage parameter	nliberg	nobody	"`FileSystemStorage` is not serializable. Because of this running `./manage.py makemigrations` for an app that contains fields that use such storage results in an exception:
{{{ValueError: Cannot serialize: <django.core.files.storage.FileSystemStorage object at 0x109c02310>}}}

'''Background''':
When `manage.py makemigrations` is run on a new app the `deconstruct` method is invoked for all fields. According to the django documentation every value in the deconstructed `kwargs` dictionary ""should itself be serializable"". However, this is not the case when one passes a `FileSystemStorage` object as `storage` parameter to the `FileField` constructor. The `deconstruct` method of the `FileFIeld` class adds the `FileSystemStorage` storage object to `kwargs` without it being serializable.

'''Fix:'''
I attach a patch that adds a `deconstruct` method to the `django.core.files.storage.FileSystemStorage` class.

'''Reproducing'''
The problem can be reproduced by starting a new app using the following models.py file and running `./manage.py makemigrations <appname>`
  {{{#!python
from django.db import models
from django.core.files.storage import FileSystemStorage

class MyModel(models.Model):
    myfile = models.FileField('File', upload_to='myfiles', storage=FileSystemStorage(location='/tmp'))
}}}"	Bug	closed	Migrations	1.7-beta-1	Release blocker	fixed	FileSystemStorage, migrations		Accepted	1	0	0	0	0	0
