Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What's new in Django 1.8

What's new in Django 1.8

Slides from talk at Django Sprint London

Marc Tamlyn

March 21, 2015
Tweet

More Decks by Marc Tamlyn

Other Decks in Programming

Transcript

  1. Django 1.8 • Release candidate is out • Final due

    around April 1st • PLEASE TEST NOW
  2. Headline features • Template engines • Model._meta formalised • Django-secure

    merged • contrib.postgres • UUID and timedelta support • Expressions • TestCase.setUpTestData
  3. Template engines • Funded work by Aymeric Augustin • API

    for template engine backends • Built in Jinja2 support
  4. Model._meta • GSOC work by Daniel Pyrathon • Official API

    to access information about fields on models • MyModel._meta.get_field('name') • MyModel._meta.get_fields() • More details in a talk from DUTH
  5. Django-secure merged • External package with security enhancements integrated by

    Erik Romijn • New SecurityMiddleware with settings for HSTS, SSL etc. • ./manage.py check --deploy
  6. UUID and timedelta • New UUIDField and DurationField for both

    models and forms. • Native support on postgres, duration native on Oracle, otherwise emulated as strings for UUID and bigint of microseconds for Duration. • Improvements to date/time arithmetic on all backends
  7. Expressions • 2k+ line, 12 month effort by Josh Smeaton

    • Significant internal refactoring of .annotate() and .aggregate() to allow custom Expression classes • Coalesce, Concat, Substr, Case/When • Combined with custom lookups significant expand the expressive power of the ORM
  8. TestCase.setUpTestData • New class method to set up data for

    a test case on a class by class level • Tests run in an atomic block and roll back to this state increasing test speed • TestCase run in a wider atomic block • Doesn't work on MyISAM • Works with fixtures, but you shouldn't
  9. Admin & Auth • Hook to override the delete view

    in the admin • Permission.name extended to 255 characters - please run migration • Hasher iterations increased 33% • last_login now has null=True
  10. GIS & MySQL • Automatic configuration of GIS by migrate

    • GeoJSON serializer • Ongoing GIS cleanup work using new ORM APIs • MySQL microsecond support
  11. Forms & Generic views • Form.has_error() • required_css_class on labels

    • Field takes label_suffix • MultipleObjectMixin.ordering • SingleObjectMixin.query_pk_and_slug
  12. Management commands • dumpdata --output <file> • runserver uses daemon

    threads • makemigrations --name • showmigrations • argparse instead of optparse
  13. Migrations • RunSQL parameter support • Data migrations for apps

    without models • Managers can be serialized as part of model state
  14. Models • default_related_name • Model.from_db • Model.refresh_from_db • Transform.bilateral •

    Can't assign unsaved models to FKs • ManyToMany methods run in transaction
  15. Models • Field.from_db_value (replaces SubFieldBase) • Query related lookups check

    model type • select_related checks fields • EmailField max length to 254
  16. Responses, Tests, Validators • FileResponse • TestCase.assertJSONEqual • --keepdb, --reverse,

    --debug-sql • URLValidator supports IPv6, unicode domains and URLs with auth data
  17. Old deprecations removed • contrib.comments • Old style transaction management

    • Old query_set style attributes • PIL support (i.e. not Pillow)
  18. Django 1.9? • More contrib.postgres • Custom indexes • Admin

    reskin • Composite fields • Whatever you do tomorrow!