diff -r 70e8e4955be0 django/db/models/fields/__init__.py
a
|
b
|
|
138 | 138 | items.append((k,v)) |
139 | 139 | obj_dict['_translated_keys'] = translated_keys |
140 | 140 | obj_dict['error_messages'] = dict(items) |
| 141 | |
| 142 | translated_items = [] |
| 143 | if isinstance(self.verbose_name, Promise): |
| 144 | args = getattr(self.verbose_name, '_proxy____args', None) |
| 145 | if args: |
| 146 | obj_dict['verbose_name'] = args[0] |
| 147 | translated_items.append('verbose_name') |
| 148 | |
| 149 | if isinstance(self.help_text, Promise): |
| 150 | args = getattr(self.help_text, '_proxy____args', None) |
| 151 | if args: |
| 152 | obj_dict['help_text'] = args[0] |
| 153 | translated_items.append('help_text') |
| 154 | obj_dict['_translated_items'] = translated_items |
141 | 155 | return obj_dict |
142 | 156 | |
143 | 157 | def __setstate__(self, obj_dict): |
… |
… |
|
145 | 159 | Unpickling support. |
146 | 160 | """ |
147 | 161 | translated_keys = obj_dict.pop('_translated_keys') |
| 162 | translated_items = obj_dict.pop('_translated_items') |
148 | 163 | self.__dict__.update(obj_dict) |
149 | 164 | for k in translated_keys: |
150 | 165 | self.error_messages[k] = _(self.error_messages[k]) |
151 | | |
| 166 | for k in translated_items: |
| 167 | self.__dict__[k] = _(self.__dict__[k]) |
| 168 | |
152 | 169 | def __cmp__(self, other): |
153 | 170 | # This is needed because bisect does not take a comparison function. |
154 | 171 | return cmp(self.creation_counter, other.creation_counter) |