Skip to content

Commit d33afb9

Browse files
committed
We're going for solution 0 friends!
django/django#19110 (comment)
1 parent a41333c commit d33afb9

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

docs/gfk.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ Consider such a model:
3030
)
3131
3232
location = GenericForeignKey('content_type', 'object_id')
33+
# required for django 5.1
34+
location.editable = True
3335
3436
def __str__(self):
3537
return self.name
3638
37-
# DJANGO 5.1
38-
TestModel.location.editable = True
39-
4039
.. danger::
4140

4241
Django 5.1 cleanup breaks this https://code.djangoproject.com/ticket/35224

test_project/select2_generic_foreign_key/models.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class TModel(models.Model):
2121
)
2222

2323
test = GenericForeignKey('content_type', 'object_id')
24+
test.editable = True
2425

2526
content_type2 = models.ForeignKey(
2627
'contenttypes.ContentType',
@@ -38,6 +39,7 @@ class TModel(models.Model):
3839
)
3940

4041
test2 = GenericForeignKey('content_type2', 'object_id2')
42+
test2.editable = True
4143

4244
for_inline = models.ForeignKey(
4345
'self',
@@ -50,11 +52,6 @@ class TModel(models.Model):
5052
def __str__(self):
5153
return self.name
5254

53-
# For Django 5.1
54-
# See https://code.djangoproject.com/ticket/36151
55-
TModel._meta.get_field('test').editable = True
56-
TModel._meta.get_field('test2').editable = True
57-
5855

5956
class TProxyModel(TModel):
6057
class Meta:

0 commit comments

Comments
 (0)