Skip to content

Add AdminMixin #49

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add AdminMixin #49

wants to merge 2 commits into from

Conversation

pfouque
Copy link
Member

@pfouque pfouque commented Jun 11, 2025

Proposal to add an AdminMixin based on https://github.com/etchegom/django-fsm-admin-lite ( #38 ).

Scope:

  • Documentation
  • Handle custom labels
  • Hide transition on purpose
  • Hide all transitions by settings with exceptions
  • django-fsm-log compatibility
  • Custom forms support (will be adressed in a following contribution)
Screenshot 2025-06-11 at 16 36 02

Copy link

codecov bot commented Jun 11, 2025

Codecov Report

Attention: Patch coverage is 94.56522% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
django_fsm/admin.py 94.56% 5 Missing ⚠️
Files with missing lines Coverage Δ
django_fsm/admin.py 94.56% <94.56%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pfouque pfouque force-pushed the feat/admin branch 3 times, most recently from 9f36a9c to 382838e Compare June 11, 2025 15:50
@pfouque pfouque force-pushed the feat/admin branch 2 times, most recently from 58095a0 to b40b3c0 Compare June 13, 2025 14:32
@pfouque pfouque self-assigned this Jun 16, 2025
@pfouque pfouque marked this pull request as ready for review June 16, 2025 14:42
@pfouque pfouque requested a review from Copilot June 25, 2025 15:30
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds an AdminMixin that integrates Django FSM transitions with the administration interface, including support for django‐fsm-log and various customizations. Key changes include dependency additions (django‐fsm-log), tests for FSM admin functionality, updates to models and admin classes for state and step transitions, and documentation updates for admin integration.

Reviewed Changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tox.ini Added django-fsm-log dependency
tests/testapp/tests/test_transition_all_except_target.py Renamed test class to align with model naming
tests/testapp/tests/test_admin.py Introduced tests to verify FSM admin transitions
tests/testapp/models.py Added AdminBlogPost model with defined FSM transitions
tests/testapp/admin.py Implemented AdminBlogPostAdmin using FSMAdminMixin
tests/settings.py Updated installed apps and configured FSM log settings
pyproject.toml Added dependency on django_fsm_log
django_fsm/templates/django_fsm/fsm_admin_change_form.html Created a template for admin change form with FSM buttons
django_fsm/admin.py Updated FSMAdminMixin implementation
README.md Provided updated documentation for admin integration
Comments suppressed due to low confidence (2)

README.md:430

  • The code example for customizing the label uses an invalid dictionary syntax; please use a colon (:) instead of '='. For example: custom={"label": "My awesome transition"}.
    fsm_field = ['my_fsm_field',]

README.md:454

  • The code example demonstrating admin transition disallowance uses an invalid dictionary syntax; please update it to use a colon, for example: custom={"admin": False}.
       custom={"admin"=False},

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