Skip to content

Latest commit

 

History

History
272 lines (164 loc) · 12 KB

CHANGELOG.md

File metadata and controls

272 lines (164 loc) · 12 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project attempts to adhere to Semantic Versioning.

Removed

  • Remove WithHistory.changed_by. This was introduced due to a misread of the django-simply-history documentation and is unneeded.

Fixed

  • Pagination in the django_twc_toolbox.crud.views.CRUDView list view now respects whether the view is using django-tables2 or the falling back to the default provided by neapolitan.

Added

  • A middleware django_twc_toolbox.middleware.WwwRedirectMiddleware for redirecting any request from a "www." subdomain to the bare domain. All credit to Adam Johnson -- How to Make Django Redirect WWW to Your Bare Domain - Adam Johnson.
  • Now supporting Django 5.1.
  • Added a changed_by field to WithHistory abstract model with a relation to a application's User model to track the source of the change through time. This will require a run of makemigrations and migrate on any model inheriting from WithHistory.

Changed

  • Bumped django-twc-package template version to v2024.27.

Fixed

  • The entirety of the WithHistory abstract model is now behind the check to see if django-simple-history is installed. Thanks to @Tobi-De for the bug report (#107).

Changed

  • Template partials are now behind a CRUDView.enable_template_partials flag. This is a breaking change as previously template partials were enabled by default. This has caused downstream issues when trying to adopt CRUDView on projects that use HTMX but have no partial template needs (at the moment).

Added

  • Added format_number_no_round function to handle formatting of numbers with a specified number of decimal places while trimming excess trailing zeros or adding zeros as needed.
  • Support for Python 3.13.

Changed

  • Bumped django-twc-package template version to v2024.24.

Added

  • Added a {% startswith %} utility templatetag filter.
  • Added a generic type argument to DatePaginator.

Changed

  • date_page_range is now explicitly a required argument to DatePaginator. Previously, it was allowed to be None, but would still fail if date_range was not passed in instead. date_range has been removed as an argument, see below.
  • Types within DatePaginator have been adjusted.

Removed

  • Removed the date_range argument from DatePaginator, a few versions past when I meant to.

Fixed

  • Fixed a bug in CRUDView.get_context_data if the role had no specific context data method defined.

Added

  • Introduced dynamic role-based context data in CRUDView with new get_role_context_data method through role-specific context methods (e.g., get_create_context_data) to add custom context data scoped only to that role.

Changed

  • get_context_data now incorporates role-specific context data by calling get_role_context_data.

Added

  • Added support for specifying primary filters on CRUDView via a filterset_primary_fields class attribute. Sometimes you have a model and corresponding crud view that has a bunch of filters attached to it. Rather than show all filters or show none and hide them behind a 'Show Filters' button, this allows you to have a handful of primary filters with the rest of the filters set as secondary. This way, you can always show the primary filters, but hide the secondary ones.
  • Added an extra method (is_active()) and property (active_filters) to the FilterSet returned by CRUDView.get_filterset related to the active filters set on the view in the current request.

Changed

  • Added override of get_paginate_by to CRUDView in order to accept arbitrary args and kwargs. This is due to the differences in the method between neapolitan.views.CRUDView and django_tables2.views.SingleTableMixin. By making this change, it simplifies the code path in the CRUDView.list method a tiny bit.

Added

  • Added django_twc_toolbox.urls.reverse and django_twc_toolbox.urls.reverse_lazy which take Django's built-in reverse and adds the ability to urlencode query parameters and fragments.

Fixed

  • Fixed pagination and ordering of CRUDView.object_list when a table_class is provided.

Fixed

  • Corrected check for HTMX request (again!).

Fixed

  • Corrected check in django_twc_toolbox.crud.CRUDView.get_template_names for if an HttpRequest is an HTMX request or not.

Added

  • Two new templatetag filters: {{ variable|klass }} and {{ variable|class_name }}.
  • Support for using django-tables2 with django_twc_toolbox.crud.CRUDView. The view now has the option to set table_class and table_data class attributes that will render the table on the list page using django-tables2.
  • Support for template partials in django_twc_toolbox.crud.CRUDView, using django-template-partials.

Fixed

  • Functions in django_twc_toolbox.sentry now correctly type hinted.

Added

  • Added django_twc_toolbox.crud app. Previously, we were maintaining a fork with a handful of customizations on top. The maintenance burden of keeping our fork updated with upstream has proven to be too much of a time commitment, so we are moving what little we have overridden here.
    • Includes a CRUDView that inherits from neapolitan.views.CRUDView with a few extra urls thrown in the template context, as well as the ability to specify different fields for the list and detail views.
    • neapolitan.templatetags.neapolitan is being shadowed allowing both {% object_detail %} and {% object_list %} to use our CRUDView's ability to use different fields (as mentioned above), as well as return the string version of any related Model. (neapolitan itself returns a Model instance's primary key.) Additionally, the action links for the list view are a dictionary instead of a rendered string.
  • Added a handful of core views: 404 and 500 error handling views and robots.txt and .well-known/security.txt views.

Removed

  • Removed support for Python 3.8 and 3.9.

Added

  • Added list_templates management command, inspired by this post from Carlton Gibson (@carltongibson).
  • Added copy_template management command, taken from this project by Andrew Miller (@nanorepublica).
  • Added ruff to dev dependency extras.
  • Added Sentry trace and profile sampling functionality with configurable discard rules for specific HTTP methods and paths.

Added

  • Added read only versions of admin.StackedInline and admin.TabularInline.

Added

  • Added a WithHistory abstract model for integrating django-simple-history HistoricalRecords.
  • Added custom createsuperuser management command to allow for resetting an existing superuser's password in development when DEBUG=True.

Added

  • Added a CuidField and extra dependencies needed to use it. Install the package with django-twc-toolbox[cuid] in order to use it.

Removed

  • Dropped support for Django 3.2 (EOL April 2024).

Added

  • py.typed added to the project.

Changed

  • Now using v2024.27 of django-twc-package.

Added

  • Added the page_date_range argument to the DatePaginator, taking the place of the existing date_range argument. This change clarifies that it represents constraining the range of dates for each page, not the entire range of dates for the paginator.

Changed

  • Updated the DatePaginator class to use the page_date_range argument instead of the deprecated date_range argument.
  • DatePage.min_date, DatePage.max_date, and DatePage.date_range are now cached_property attributes instead of being set in the __init__ method.
  • Now using django-twc-package template for repository and package structure.

Deprecated

  • The date_range argument of the DatePaginator class is now deprecated. It will be removed in version 0.4.0.

Removed

  • Removed the orphans kwarg from DatePaginator, which is inherited from Django's built-in Paginator. Given its date range-based pagination, the concept of orphans, applicable to item count per page, is not super useful. If it is passed in, a warning will be issued.

Fixed

  • DatePage.min_date and DatePage.max_date now return the correct dates for the page. DatePage.min_date returns the oldest date and DatePage.max_date returns the newest date.
  • DatePage.date_range now returns the correct range of dates for the page.

Added

  • DatePaginator and DatePage classes, extending Django's built-in Paginator and Page classes, respectively. These new classes enable pagination based on a specified date field, making it easier to work with date-based data. Useful for applications that require handling of time-series data or chronological records, such as a blog or an event archive.

Initial release!

Added

  • Initial documentation.
  • Initial tests.
  • Initial CI/CD (GitHub Actions).
  • A TimeStamped abstract model for adding created_at and updated_at fields to models.

New Contributors