Skip to content

Commit 91a382d

Browse files
authored
fix: incompatibility with djangocms-versioning-filer 1.3 was fixed (#1509)
When used with djangocms-versioning-filer, the `FileAdminChangeForm` might not have a file field due to missing permissions. Since djangocms-versioning-filer 1.3 the constructor of `FileAdminChangeForm` crashes when opening the change URL of a published image. This patch fixes this issue by adding a check whether the file field is present before overriding it. Signed-off-by: Florian Scherf <[email protected]>
1 parent fc34247 commit 91a382d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

filer/admin/fileadmin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class Meta:
3535

3636
def __init__(self, *args, **kwargs):
3737
super().__init__(*args, **kwargs)
38-
self.fields["file"].widget = forms.FileInput()
38+
if "file" in self.fields:
39+
self.fields["file"].widget = forms.FileInput()
3940

4041
def clean(self):
4142
from ..validation import validate_upload

0 commit comments

Comments
 (0)