File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
test_project/select2_generic_foreign_key Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -30,13 +30,12 @@ Consider such a model:
30
30
)
31
31
32
32
location = GenericForeignKey(' content_type' , ' object_id' )
33
+ # required for django 5.1
34
+ location.editable = True
33
35
34
36
def __str__ (self ):
35
37
return self .name
36
38
37
- # DJANGO 5.1
38
- TestModel.location.editable = True
39
-
40
39
.. danger ::
41
40
42
41
Django 5.1 cleanup breaks this https://code.djangoproject.com/ticket/35224
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ class TModel(models.Model):
21
21
)
22
22
23
23
test = GenericForeignKey ('content_type' , 'object_id' )
24
+ test .editable = True
24
25
25
26
content_type2 = models .ForeignKey (
26
27
'contenttypes.ContentType' ,
@@ -38,6 +39,7 @@ class TModel(models.Model):
38
39
)
39
40
40
41
test2 = GenericForeignKey ('content_type2' , 'object_id2' )
42
+ test2 .editable = True
41
43
42
44
for_inline = models .ForeignKey (
43
45
'self' ,
@@ -50,11 +52,6 @@ class TModel(models.Model):
50
52
def __str__ (self ):
51
53
return self .name
52
54
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
-
58
55
59
56
class TProxyModel (TModel ):
60
57
class Meta :
You can’t perform that action at this time.
0 commit comments