1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #13328 -- Added a __getstate__/__setstate__ pair to fields so that callable default values aren't pickled. Thanks to bkonkle for the report, and Vitaly Babiy for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2010-04-15 12:41:08 +00:00
parent d9aaad4e36
commit 2faa3acb4b
6 changed files with 49 additions and 6 deletions

View File

@@ -1,8 +1,20 @@
import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Numbers(object):
@classmethod
def get_number(self):
return 2
class Group(models.Model):
name = models.CharField(_('name'), max_length=100)
class Event(models.Model):
group = models.ForeignKey(Group)
class Happening(models.Model):
when = models.DateTimeField(blank=True, default=datetime.datetime.now)
name = models.CharField(blank=True, max_length=100, default=lambda:"test")
number = models.IntegerField(blank=True, default=Numbers.get_number)