Skip to content

Commit

Permalink
fix: incompatibility with djangocms-versioning-filer 1.3 was fixed (#…
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
fscherf authored Dec 6, 2024
1 parent fc34247 commit 91a382d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion filer/admin/fileadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class Meta:

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["file"].widget = forms.FileInput()
if "file" in self.fields:
self.fields["file"].widget = forms.FileInput()

def clean(self):
from ..validation import validate_upload
Expand Down

0 comments on commit 91a382d

Please sign in to comment.