﻿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
19635	Allow fields to be pickled	Anssi Kääriäinen	nobody	"Model field instances are not pickleable currently because the field's model isn't necessarily available (autocreated m2m models for example). This causes some ugly code in django.db.models.sql.query.Query `__getstate__` and `__setstate__` methods as we need to avoid pickling the fields found from the various structs in the Query.

To avoid this problem we can use `__reduce__` to make fields pickleable. The idea is that we save the field's identifier (app_lable, model_name, field_name) in pickling, then use app cache to load the model, and then the field from the model in unpickling. This makes the Query code much nicer, and allows for extended use of fields in the Query structures.

Patch available from https://github.com/akaariai/django/tree/field_pickle"	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed			Accepted	1	0	0	0	0	0
