Skip to content

ashleywaite/django-more

Repository files navigation

django-more

A collection of Django patches and extensions to give more of the features and functionality that I want or expect from Django.
Currently aimed only at Django 1.11

django_more

django_more contains field and classes for Django that do not require any patching and can be used directly.

  • django_more.storages
    Allows defining Django storages in settings and generating the storage classes as needed in django_more.storages.NAME.
  • django_more.PartialIndex
    Database partial indexes using Django query and Q() notation.
    Working on postgres, untested elsewhere.
  • django_more.HashField
    Field for storing hashes and removing the issues with comparing, generating, and converting hashes.
  • django_more.OrderByField (requires django_types)
    Field for order_with_respect_to similar functionality, with support for an arbitrary number of fields in the ordering, database constraints, bulk updates, single query creation, and generic keys.

Placing django_more into Django INSTALLED_APPS will automatically invoke django_types.patch_types() - only necessary for OrderByField makemigrations

django_enum

django_enum patches Django to add EnumFields, with enum state information in migrations to allow for consistent migrations compatible with postgres and mysql.

  • django_enum.EnumField (requires django_types)
    Django field based upon python 3.4 (PEP435) Enum with support for database enum fields.
  • django_enum.enum_meta
    Decorator to hide Meta classes in standard python Enum.
  • django_enum.patch_enum()
    Applies patches to Django necessary for this module to work.

Placing django_enum into Django INSTALLED_APPS will automatically invoke patch_enum() and django_types.patch_types()

django_types

django_types patches Django to add support for custom database types to be used within migrations.
Not intended to be used directly, but by other reusable apps adding fields that rely on the additional functionality.

  • django_types.CustomTypeField
    Base implementation for custom types that can be managed within the migration framework.
  • django_types.patch_types()
    Applies patches to Django necessary for this module to work.

Apps dependent on this should check for ProjectState.add_type() support, and if not present apply this with patch_types()

django_cte

django_cte patches Django to add CTE based functionality.

  • django_cte.patch_cte()
    Applies patches to Django necessary for this module to work.

Not included in distributions until out of WIP state
Placing django_cte into Django INSTALLED_APPS will automatically invoke patch_cte()

patchy

patchy is class based monkey patching package used by the other django-more modules to apply their patches in a consistent and safe manner that is hopefully less fragile to Django core changes.

  • patchy.patchy()
    Creates a class and context manager to apply patches.
  • patchy.super_patchy()
    Provides functionality similar to super() to functions and methods that have been patched in, allowing calls the methods they replaced.



Version History

0.2.6

  • Bugfix: EnumField forces choice values to string so behaviour is unambiguous and works with Django Rest Framework
  • Added: NullCharField that treats and saves blank values as nulls

0.2.5

  • Bugfix: EnumField now serialises to text value of Enum member
  • Bugfix: EnumField now accepts strings that represent an Enum member as valid values

0.2.4

  • Bugfix: EnumField alter operations with a missing argument now correctly accepted

0.2.3

  • Bugfix: patchy exposes exceptions more correctly.
  • Added: django_types patches migrations to use field based dependencies and moves default functionality onto Field and RelatedField.

0.2.2

  • Added: Arbitrary field dependencies via django_types.
  • Bugfix: OrderByField uses dependencies to prevent field creation order issues.

0.2.1

  • Added: OrderByField now matches all order_with_respect_to functionality.
  • Documentation: django_more module, substantial rewrite and expansion of README.
  • Documentation: django-more base README substantially cleaned up.
  • Bugfixes: Migrations interacting badly with OrderByField and defaults.

0.2.0

  • Added: django_more.OrderByField.
  • Bugfix: A bad reference caused EnumField to break on cascade.
  • Bugfix: Defaults to EnumField are stringified so that migrations don't break if Enums are relocated.
  • Refactored: django_more.fields into sub-module.
  • Documentation: django_more module, added README.

0.1.1

  • Bugfix: Include django_types in distribution as necessary for django_enum.

0.1.0

  • Initial release without django_cte module.
  • Added: django_enum.EnumField.
  • Added: django_more.PartialIndex.
  • Added: django_more.HashField.
  • Added: django_more.storages.
  • Documentation: django_enum module, added README.
  • Documentation: django_types module, added README.
  • Documentation: patchy module, added README.

About

Getting more out of Django!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages