Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method clean_subject_location not implemented correctly #1464

Merged
merged 1 commit into from
May 17, 2024

Conversation

jrief
Copy link
Collaborator

@jrief jrief commented May 17, 2024

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

  • I have opened this pull request against master
  • I have added or modified the tests when changing logic
  • I have followed the conventional commits guidelines to add meaningful information into the changelog
  • I have read the contribution guidelines and I have joined #workgroup-pr-review on
    Slack to find a “pr review buddy” who is going to review my pull request.

@jrief jrief force-pushed the fix-clean_subject_location branch from 1fe1829 to ec71b6e Compare May 17, 2024 10:11
Copy link
Sponsor Member

@fsbraun fsbraun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted!

@fsbraun fsbraun merged commit 99e8f24 into master May 17, 2024
82 checks passed
@jrief
Copy link
Collaborator Author

jrief commented May 17, 2024

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
Copy link
Sponsor Member

fsbraun commented May 17, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants