Published on

Release: CSV Permissions 0.2, file upload restrictions and more

Authors
  • Name
    Dave Coates

This release contains changes up until release/2022-01-24.

To upgrade any existing projects it's recommended to pull in the relevant commits from upstream.

git remote add upstream git@gitlab.internal.alliancesoftware.com.au:alliance/template-django.git
git cherry-pick XXX1 XXX2

In cases where you are significantly behind it may be easier to pull the whole app (eg. common_audit) in but you'll need to review the relevant branch.


In this release

CSV Permissions 0.2

csvpermissions 0.2.0 has been released.

See the presentation Levi did on it for more details.

See commit 7ca0b9c8 for example of how to upgrade an existing project.

File upload size/type restrictions

You can now set a max size limit and file type restrictions on AsyncFileField .

File size can be restricted by passing in max_size (in MB)

The file extension/file type can be restricted by passing in file_restrictions (eg. ["image/png", "image/jpeg"])

Thanks to Jason for implementing this.

See commit 8d571b2d

Typography styles & responsive navigation

Thanks to Aaron there are now some base typography styles in the template:

  • Adds explicit heading styles. Previously these were browser default
  • Adds mixins so you can use heading sizes in CSS
  • Screen reader only styles and mixin

There is now also responsive layout and mobile menu.

See commit 822c0862 for typography styles

See commit 28e24148 for responsive navigation

DRF exception handler for core exceptions

DRF has an exception handler such that if you throw a DRF ValidationError it handles it and returns a 400 response. Throwing a core django validation error resulted in a 500 response which is annoying if you are validating things using the model clean method for example.

This change implements an exception handler to handle core ValidationError exceptions as well.

Thanks to Callum for implementing this.

See commit 2e7616ac

Django form date/datetime widgets

Thanks to Jason and James there's now widgets for Date and DateTime fields in django forms (rather than just a standard text input box).

See commit a78c02fd

CSV Download Mixin

Thanks to Callum there's now a mixin that can be added to CrudListView to enable a CSV download.

See commit bac3961b

Package releases

We are now up to 0.0.24 on Presto. Since last release announcement there's been a number of releases mostly with minor bug fixes. 0.0.23 contains two fixes that can cause serious issues when using SelectAsyncChoicesWidget and generally improves the usability of the component.

allianceutils has had 2.1.0 released to support new URL pattern adopted in django and to handle new version of husky. These changes relate only to system checks.

Other changes

  • 16d75ddf Centralise user type definitions
  • 1c559bea freeze.sh now requires you to pass either --upgrade or --no-upgrade
  • d97d39c7 Add load_from_csv function
  • 06dc53cd Add --no-commit flag to createdevdata
  • 6d6e8846 Add common_ant module and antd tabs
  • e357ffda Upgrade husky to v7 (note you need to upgrade allianceutils as well)
  • 51697e77 Upgrade lint-staged to v11
  • 09179a14 Audit module no longer breaks for manual events on M2M models
  • ac0b1845 Default filters on CrudFilterListView
  • 40130fe9 Sets explicit expiry time on artifacts which makes gitlab pages work again
  • 2ef30c78 get_choices can now be passed a QuerySet directly

Did you know?

Server choices can be used to add an autocomplete lookup for choices you wish to load from the server (usually backed by a QuerySet but can be anything).

The server_choices decorator works on Serializer class,Form class and FilterSet class so you can easily add it to either React based code or django form based code.