diff -Naur Django-1.2.3.orig//django/contrib/contenttypes/generic.py Django-1.2.3/django/contrib/contenttypes/generic.py
old
|
new
|
|
49 | 49 | # Convenience function using get_model avoids a circular import when |
50 | 50 | # using this model |
51 | 51 | ContentType = get_model("contenttypes", "contenttype") |
52 | | if obj: |
| 52 | if obj is not None: |
53 | 53 | return ContentType.objects.db_manager(obj._state.db).get_for_model(obj) |
54 | | elif id: |
| 54 | elif id is not None: |
55 | 55 | return ContentType.objects.db_manager(using).get_for_id(id) |
56 | 56 | else: |
57 | 57 | # This should never happen. I love comments like this, don't you? |
diff -Naur Django-1.2.3.orig//tests/regressiontests/generic_relations_regress/models.py Django-1.2.3/tests/regressiontests/generic_relations_regress/models.py
old
|
new
|
|
4 | 4 | |
5 | 5 | __all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address', |
6 | 6 | 'CharLink', 'TextLink', 'OddRelation1', 'OddRelation2', |
7 | | 'Contact', 'Organization', 'Note') |
| 7 | 'Contact', 'Organization', 'Note', 'Meeting') |
8 | 8 | |
9 | 9 | class Link(models.Model): |
10 | 10 | content_type = models.ForeignKey(ContentType) |
… |
… |
|
77 | 77 | name = models.CharField(max_length=255) |
78 | 78 | contacts = models.ManyToManyField(Contact, related_name='organizations') |
79 | 79 | |
| 80 | class Meeting(models.Model): |
| 81 | name = models.CharField(max_length=100) |
| 82 | |
| 83 | def __len__(self): |
| 84 | return 0 |
| 85 | |
diff -Naur Django-1.2.3.orig//tests/regressiontests/generic_relations_regress/tests.py Django-1.2.3/tests/regressiontests/generic_relations_regress/tests.py
old
|
new
|
|
70 | 70 | Q(notes__note__icontains=r'other note')) |
71 | 71 | self.assertTrue(org_contact in qs) |
72 | 72 | |
| 73 | def test_not_null_comparison(self): |
| 74 | """ |
| 75 | Tests if an object which is logical False can be assigned to a |
| 76 | GenericForeignKey |
73 | 77 | |
| 78 | Tests for bug http://code.djangoproject.com/ticket/14325 |
| 79 | """ |
| 80 | meeting = Meeting.objects.create(name='empty meeting') |
| 81 | link = Link(content_object=meeting) |
74 | 82 | |