Skip to content

feat: remove duplicate delete action and update German translations - #19

Merged
metaforx merged 1 commit into
mainfrom
fix/remove-duplicate-delete-action
Apr 10, 2026
Merged

feat: remove duplicate delete action and update German translations#19
metaforx merged 1 commit into
mainfrom
fix/remove-duplicate-delete-action

Conversation

@metaforx

@metaforx metaforx commented Apr 10, 2026

Copy link
Copy Markdown
Owner
  • Improve delete handling in Admin

Summary by Sourcery

Unify admin form deletion messaging and disable the default bulk delete action in favor of the safe delete flow.

Enhancements:

  • Simplify admin delete handlers for forms and rename the safe bulk delete action to be the primary delete option.

Documentation:

  • Update German localization strings to reflect the revised admin delete action labels.

@sourcery-ai

sourcery-ai Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors admin delete handling for form entries to remove the default bulk delete action in favor of the custom safe delete, simplifies delete messaging to use obj.name directly, and updates the German translation strings to match the new action description and messages.

Sequence diagram for updated safe delete handling in admin

sequenceDiagram
    actor AdminUser
    participant DjangoAdmin
    participant FormEntryProxyAdmin
    participant FormEntry
    participant Messages

    AdminUser->>DjangoAdmin: Submit bulk delete request
    DjangoAdmin->>FormEntryProxyAdmin: safe_delete_selected(request, queryset)
    loop For each obj in queryset
        FormEntryProxyAdmin->>FormEntryProxyAdmin: _safe_delete_form(obj)
        FormEntryProxyAdmin->>FormEntry: delete()
        FormEntryProxyAdmin->>Messages: info(request, The form {obj.name} was deleted successfully.)
    end
    FormEntryProxyAdmin-->>DjangoAdmin: HttpResponse
    DjangoAdmin-->>AdminUser: Updated changelist with success messages
Loading

Class diagram for updated admin form entry delete handling

classDiagram
    class FormEntryProxyAdmin {
        +delete_model(request, obj)
        +delete_queryset(request, queryset)
        +get_actions(request)
        +safe_delete_selected(request, queryset)
        -_safe_delete_form(form_entry)
    }
Loading

File-Level Changes

Change Details Files
Unify and simplify admin delete handling for single and bulk form deletions while removing the default "delete_selected" action.
  • In delete_model, remove the temporary name variable and format the success message directly with obj.name after calling _safe_delete_form
  • In delete_queryset, remove the temporary name variable and format the per-object success message directly with obj.name after calling _safe_delete_form for each item
  • Override get_actions to remove the default "delete_selected" action from the admin, ensuring only the custom safe_delete_selected action is available
  • Update the @admin.action description text from "Delete selected forms (safe)" to "Delete selected forms" to reflect its primary role as the standard bulk delete action
src/unfold_fobi/admin/form_entry_proxy.py
Align German translations with the updated admin delete action labels and messages.
  • Update or add German translation entries for the modified delete-related message strings, including the admin action description and form deletion success messages
  • Ensure the .po catalog remains consistent and ready for recompilation to .mo files
src/unfold_fobi/locale/de/LC_MESSAGES/django.po

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!

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In delete_queryset, consider aggregating deletions into a single success message (e.g., with a count or list) rather than emitting one message per object to avoid spamming the messages framework on large querysets.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `delete_queryset`, consider aggregating deletions into a single success message (e.g., with a count or list) rather than emitting one message per object to avoid spamming the messages framework on large querysets.

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.

@metaforx
metaforx merged commit aa77ef9 into main Apr 10, 2026
4 checks passed
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.

1 participant