﻿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
20157	Cannot pickle prefetched queryset on model with callable default datetime.datetime.now	thomaspurchas	nobody	"With the follow models

{{{
class Post(models.Model):
    post_date = models.DateTimeField(default=datetime.datetime.now)

class Material(models.Model):
    post = models.ForeignKey(Post, related_name='materials')
}}}

When the following is run

{{{
post = Post.objects.create()
posts = Post.objects.all()
posts = posts.prefetch_related('materials')
pickle.dumps(posts)
}}}

Pickle returns the following error {{{PicklingError: Can't pickle <built-in method now of type object at 0x10782c640>: it's not found as __main__.now}}}.

This appears to be some sort of repeat of issue #13328, and it only affects 1.5. Using bisect I have found the first commit that breaks this [https://github.com/django/django/commit/056ace0f395a 056ace0f395a].

I have also attached a complete traceback."	Bug	closed	Database layer (models, ORM)	1.5	Normal	fixed	pickle, queryset	thomaspurchas Florian Apolloner bmispelon@…	Accepted	0	0	0	0	0	0
