Skip to content

v0.4.0

Choose a tag to compare

@AghastyGD AghastyGD released this 10 Mar 20:33
· 57 commits to main since this release
14b3af0

Release Notes for Version 0.4.0

New Features

  • controller_for decorator: Introduced a new decorator controller_for in registry.py to automatically register a controller for a model. This simplifies the creation and registration of custom controllers, making it easier for developers to implement custom hooks.
  • Kebab-Case Conversion Utility: Added a new utility function to_kebab_case in helpers.py that converts strings from various formats (CamelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE) to kebab-case. This is useful for URL handling.
  • Pagination and Filtering Functionality:
    • Implemented pagination and filtering (sort and order) in the routes.
    • Created custom functions for handling pagination and filters.
    • Organized the code by introducing a new module pagination.py and enhancing helpers.py.
    • Enabled selection of the pagination type via the pagination_type parameter or the NINJA_PAGINATION_CLASS setting.
    • Leveraged page limit configuration using the NINJA_PAGINATION_PER_PAGE setting.

Improvements

  • Module Import Handling: Added new discover_controllers method in registry.py to improve module import handling. This ensures that all controller modules are correctly imported and registered.

Documentation

  • Updated Documentation: Updated the README to reflect the new controller_for decorator. Added examples and usage instructions for the new feature

Tests

  • Unit tests for kebab-case: Added unit tests for the to_kebab_case function to ensure correct conversion from various string formats to kebab-case.
  • Manually tested the controller_for decorator and pagination and filters feature to ensure proper integration and behavior.

Breaking Changes

  • None

How to Upgrade

  1. Update your project dependencies to include the new version of Lazy Ninja.
  2. Review the updated documentation to understand the new controller_for decorator and how to use it for custom controllers.
  3. Run the new unit tests to ensure that your project is compatible with the new version.