Skip to content

fix: Relect template block structure of Django 5.2+ #1523

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

Merged
merged 7 commits into from
Apr 12, 2025

Conversation

fsbraun
Copy link
Member

@fsbraun fsbraun commented Apr 10, 2025

Description

Django 5.2 changes the block structure of the admin base template:

  • object-tools are not part of content any more

This PR reflects this (otherwise leading to the object tools being shown twice #1522 ) by replacing the
block object tools by {% block filer-tools %}.

Fixes #1522

Attention

Custom filer templates might need to be adjusted for django 5.2 or later. (This is an immediate effect of the (breaking) change in django 5.2).

Related resources

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.

Summary by Sourcery

Update Django admin template blocks to be compatible with Django 5.2's new template structure

Bug Fixes:

  • Prevent duplicate object tools display in Django 5.2+ admin templates

Enhancements:

  • Modify template blocks to align with Django 5.2 template structure changes

Documentation:

  • Add note about potential custom template adjustments required for Django 5.2

Summary by Sourcery

Update Django admin template block structure to be compatible with Django 5.2+ by replacing object-tools block with filer-tools block

Bug Fixes:

  • Prevent duplicate object tools display in the admin interface

Enhancements:

  • Modernize documentation build configuration
  • Update dependencies to latest versions

Documentation:

  • Update documentation requirements and configuration to support newer Python and Django versions

Copy link
Contributor

sourcery-ai bot commented Apr 10, 2025

Reviewer's Guide by Sourcery

This pull request addresses compatibility issues with Django 5.2 by updating the template structure and dependencies. The primary change involves adjusting the template blocks in directory_listing.html to prevent duplicate object tools from being displayed. Additionally, the pull request updates the project's dependencies and documentation configuration.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Reflect Django 5.2 template block structure changes in directory_listing.html to prevent duplicate object tools display.
  • Remove the object-tools block.
  • Add an empty object-tools block to prevent inheritance from the base template.
  • Replace the object-tools block with a filer-tools block.
  • Rename the object-tools-items block to filer-tools-items.
filer/templates/admin/filer/folder/directory_listing.html
Update requirements.txt to reflect updated dependencies and use requirements.in for pip-compile.
  • Update Django version to 4.2.20.
  • Update dependencies to their latest versions.
  • Add requirements.in file.
  • Use --extra-index-url https://www.piwheels.org/simple to speed up dependency resolution on Raspberry Pi.
  • Add build and pip-tools as dependencies.
docs/requirements.txt
docs/requirements.in
Update documentation dependencies and intersphinx mapping in conf.py.
  • Update intersphinx mapping to include Python 3 and Django.
  • No longer specify dependencies as part of the extensions list.
docs/conf.py
Fix styling issue in directory_table_list.html.
  • Fix height calculation for folder icon in table view.
filer/templates/admin/filer/folder/directory_table_list.html

Assessment against linked issues

Issue Objective Addressed Explanation
#1522 Fix the duplication of navigator-tools in Django 5.2+ admin interface.
#1522 Adjust custom filer templates to be compatible with Django 5.2+.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@fsbraun fsbraun marked this pull request as ready for review April 10, 2025 14:01
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @fsbraun - I've reviewed your changes - here's some feedback:

Overall Comments:

  • It would be good to have a test case that verifies the fix for the reported issue.
  • Consider adding a comment in the template explaining why the object-tools block is being emptied.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@fsbraun fsbraun requested a review from vinitkumar April 10, 2025 14:03
Copy link
Member

@vinitkumar vinitkumar left a comment

Choose a reason for hiding this comment

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

Looks good to me. Let's get this merged and released 🚢 🚀

@vinitkumar vinitkumar merged commit 160ad7e into master Apr 12, 2025
86 checks passed
@vinitkumar vinitkumar deleted the fix/object-tools branch April 12, 2025 06:57
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.

Duplicated navigator-tools in Django 5.2
2 participants