Skip to content

Releases: hbakri/django-ninja-crud

v0.3.0

24 Aug 12:33
a8f7f01
Compare
Choose a tag to compare

Release Notes: v0.3.0 🎉

Date: August 24, 2023

I'm excited to introduce version v0.3.0 of Django Ninja CRUD. This release has been one of my most ambitious, encompassing approximately 70 pull requests filled with new features, refinements, fixes, and more. Here's a breakdown of what's new:

🌟 Highlights

  • Revamped Test Suite: Undertook a major overhaul of the test suite to introduce new components like RequestComposer and enforce TestCase inheritance for ModelViewSetTest subclasses. These changes bring robustness and intuitiveness to our testing environment.

  • Introduction of PartialUpdateModelView: The new PartialUpdateModelView class allows for more precise updates, simplifying and enhancing your data manipulation workflows (#85, #129).

  • UX-Focused List and Create Model Views: Improved user experience by adopting Django's verbose_name in list and create views, making the interface more readable and user-friendly (#167).

  • Comprehensive Refactoring: Conducted a sweeping code clean-up and restructuring for improved maintainability and future development.

  • First Complete Version of View Documentation: Accomplished a significant milestone by providing comprehensive documentation for all views, serving as a detailed guide for users and contributors alike (available here).

✨ New Features

  • Old Instance Parameter in Save Hooks: Added old_instance parameter to pre_save and post_save hooks for more complex business logic during save operations (#45).
  • List Type Support for Testing Suite: Enhanced the testing suite to support attributes of the list type (#47).
  • Views and Tests Matching Validation: Introduced validation to ensure that for each view, a corresponding test exists (#70).
  • TestCase Enforced for ModelViewSetTest Subclasses: Now requiring that any subclass of ModelViewSetTest must also inherit from Django's TestCase (#73).
  • Type Verification for Test Class Attributes: Implemented type verifications for ModelViewSetTest class attributes to ensure robust and reliable tests (#81).
  • Partial Updates with PartialUpdateModelView : Enabled partial updates to models using the new PartialUpdateModelView class (#85, #129).
  • Type Verification for ModelViewSet Class Attributes: Added type verifications to ensure runtime safety and reduce errors due to type mismatches (#90).
  • Router Customization via router_kwargs: Introduced the router_kwargs attribute for customizing Django Ninja's Router attributes, providing more control over API routes (#93).
  • Custom Queryset Validation in Retrieve View: Added queryset_getter validator for RetrieveModelView for more complex queries and added validation (#157).
  • User-Friendly Model Naming in List and Create Views: Switched to using Django's verbose_name for a more readable and user-friendly presentation in list and create views (#167).

🛠️ Refactorings

  • Codebase Organization and File Structure: Split AbstractModelView and ModelViewSet classes into separate files to enhance code organization (#71, #54).
  • Improvements in Test Class Definitions: Introduced RequestComposer and TestAssertionHelper for a more robust and comprehensive testing environment, and employed attribute names for unique test method naming in ModelViewSetTest (#49, #80, #57, #54, #52, #77, #78).
  • Attribute Renaming and Removal for Test Classes: Removed redundant attributes like client, name, model_view_set_class, and urls_prefix from AbstractModelViewTest, and renamed attributes to better reflect their roles such as changing test_case to model_view_set_test (#60, #58, #78, #77).
  • Url Prefix and Base Path Terminology: Renamed methods and attributes related to URL prefixes to align with the more general term base_path (#89, #87).
  • Schema Definitions and Type Handling: Added and renamed various type aliases for better code readability and context understanding, and renamed schema generation methods to better reflect their functionalities (#181, #146, #148, #130).
  • Streamlining of Model Views: Removed redundant and unused attributes and methods such as related_model, and introduced new methods like _configure_route and _save_model for better code separation (#172, #154, #169, #137, #135).
  • Clarity in Naming and Functionality: Renamed several key attributes and methods, such as instance_builder to model_factory, to provide a more intuitive understanding (#190, #129, #61).

🐛 Bug Fixes

  • Badge URL in README: Fixed the downloads badge URL in README (#156).
  • Guide File Order in Documentation Sidebar: Resolved an issue where the files in the documentation sidebar were not in the correct order (#124).
  • Type Annotation for model_view_set_class Attribute: Fixed incorrect type annotations for the model_view_set_class attribute in ModelViewSetTest class (#68).
  • Save and Delete Hooks Typing: Resolved type-related issues in the save and delete hooks to improve code quality and reliability (#44).

📚 Documentation

  • Updated README: The README has been updated to reflect the latest changes and offer clearer guidance (#193, #185).
  • In-depth View Docstrings: Improved and added detailed docstrings for various views, enhancing the inline documentation (#180, #178, #174, #164, #162, #159, #110, #109, #108).
  • Home Page Documentation: Added a Home page to the documentation (#183).

🙏 Acknowledgments

Up until this point, the journey of developing and maintaining this open-source package has been a solo endeavor. However, the essence of open-source is community, and I'm elated to announce that this release marks a significant milestone—our community is growing!

Welcome New Contributors!

In this release, I'm honored to welcome our very first external contributors to the project. Your active involvement not only enriches the codebase but also amplifies the spirit of collaborative development.

  • @chengfangho: Your refactoring, which renamed the ModelViewSet class attribute from model to model_class, has made the code more maintainable and intuitive (#61).

  • @lucasrcezimbra: Your feature introducing router_kwargs adds a new layer of customization and flexibility to Django-Ninja's Router attributes. This is a critical enhancement that users will find extremely beneficial (#93).

  • @kuramen: And a special acknowledgment goes to my friend and colleague, who made the project more visually engaging by integrating both the project and Django-Ninja logos into our README. Kuramen, your creative touch inspired the idea for the logo and made a significant impact on how newcomers perceive our project (#92).

New contributors, your additions are invaluable and warmly welcomed. The project is all the richer for your involvement, and I'm eager to see how your future contributions will continue to enhance our growing community.

v0.2.0

04 Jul 20:34
5d69b6b
Compare
Choose a tag to compare

Added

  • support every pk type, and support callable params in tests. (#24)
  • create CONTRIBUTING.md (#29)

Changed

  • drop support for python 3.7. (#32)
  • refactor params objects in tests. (#36)

Fixed

  • remove Callable warnings. (#26)
  • use pk instead of id in views. (#31)
  • raise 404 for non-existing id on detail views. (#33)

v0.1.3

25 Jun 21:06
c1c1028
Compare
Choose a tag to compare

Added

  • support int primary key. (#14)
  • allow testing limit and offset pagination parameters. (#18)

Changed

  • removed .dockerignore, Makefile and poetry.lock files. (#20)
  • changed filters type of ListModelViewTest class to Payloads. (#16)

Fixed

  • updated README.md (#13, #21) and the documentation.
  • added django and django-ninja version matrix for tests workflow. (#8)

v0.1.2

18 Jun 20:26
c0b69d2
Compare
Choose a tag to compare

Added

  • Added filters attribute to ListModelView class. (#5)

Changed

  • Renamed is_instance_view to detail. (#7)
  • Made credentials_getter optional for every test classes.

Fixed

  • Addressed all areas of the codebase that were missing test coverage. The project now has 100% test coverage.