| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Django
Revision: 8957
Author: mtredinnick
Date: 03 Sep 2008 18:45:33
Diff at Trac: http://code.djangoproject.com/changeset/8957
Changes:Fixed #8841 -- Fixed a case of ForeignKeys to models constructed with
inheritance.
This patch is uglier than it needs to be (see comment in patch) to ensure no
accidental bug is introduced just before 1.0. We'll clean it up later.
| ... | ...@@ -570,7 +570,13 @@ | |
| 570 | 570 | |
| 571 | 571 | def choice(self, obj): |
| 572 | 572 | if self.field.to_field_name: |
| 573 | key = getattr(obj, self.field.to_field_name) | |
| 573 | # FIXME: The try..except shouldn't be necessary here. But this is | |
| 574 | # going in just before 1.0, so I want to be careful. Will check it | |
| 575 | # out later. | |
| 576 | try: | |
| 577 | key = getattr(obj, self.field.to_field_name).pk | |
| 578 | except AttributeError: | |
| 579 | key = getattr(obj, self.field.to_field_name) | |
| 574 | 580 | else: |
| 575 | 581 | key = obj.pk |
| 576 | 582 | return (key, self.field.label_from_instance(obj)) |