django-cms / django-filer

File and Image Management Application for django
https://django-filer.readthedocs.io/
Other
1.76k stars 577 forks source link

method clean_subject_location not implemented correctly #1464

Closed jrief closed 4 months ago

jrief commented 4 months ago

Description

Method clean_subject_location not implemented correctly.

According to the Django docs and to my own experience, a method for cleaning a specific field attribute should not itself call super().clean(). This is because this method is invoked later anyway. In the current implementation the method FileAdminChangeFrom.clean() is called twice, which in my opinion should not happen.

It also sometimes causes problems if users try to replace an image using the Filer's admin image detail view.

Since no functionality changed, I did not add any extra test.

Checklist

jrief commented 4 months ago

sorry, unfortunately clean_data['owner'] might not be set. Just found out while testing locally. owner isn't used anyway in validate_upload(…) so using cleaned_data.get("owner") is safer.

fsbraun commented 4 months ago

Where's cleaned_data["owner"] used and how does that affect the PR? Maybe that's another PR?