Slide 1

Slide 1 text

What's new in Django 1.8 From Arrays to Validators

Slide 2

Slide 2 text

Django 1.8 • Release candidate is out • Final due around April 1st • PLEASE TEST NOW

Slide 3

Slide 3 text

Headline features • Template engines • Model._meta formalised • Django-secure merged • contrib.postgres • UUID and timedelta support • Expressions • TestCase.setUpTestData

Slide 4

Slide 4 text

Template engines • Funded work by Aymeric Augustin • API for template engine backends • Built in Jinja2 support

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

Django-secure merged • External package with security enhancements integrated by Erik Romijn • New SecurityMiddleware with settings for HSTS, SSL etc. • ./manage.py check --deploy

Slide 7

Slide 7 text

django.contrib.postgres • Made possible by awesome kickstarter backers • ArrayField, RangeField, HStoreField • unaccent lookup

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

GIS & MySQL • Automatic configuration of GIS by migrate • GeoJSON serializer • Ongoing GIS cleanup work using new ORM APIs • MySQL microsecond support

Slide 13

Slide 13 text

Forms & Generic views • Form.has_error() • required_css_class on labels • Field takes label_suffix • MultipleObjectMixin.ordering • SingleObjectMixin.query_pk_and_slug

Slide 14

Slide 14 text

Management commands • dumpdata --output <file> • runserver uses daemon threads • makemigrations --name • showmigrations • argparse instead of optparse

Slide 15

Slide 15 text

Migrations • RunSQL parameter support • Data migrations for apps without models • Managers can be serialized as part of model state

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

Models • Field.from_db_value (replaces SubFieldBase) • Query related lookups check model type • select_related checks fields • EmailField max length to 254

Slide 18

Slide 18 text

Responses, Tests, Validators • FileResponse • TestCase.assertJSONEqual • --keepdb, --reverse, --debug-sql • URLValidator supports IPv6, unicode domains and URLs with auth data

Slide 19

Slide 19 text

Deprecations • patterns() and string related view referencing • NoArgsCommand

Slide 20

Slide 20 text

Old deprecations removed • contrib.comments • Old style transaction management • Old query_set style attributes • PIL support (i.e. not Pillow)

Slide 21

Slide 21 text

Django 1.9? • More contrib.postgres • Custom indexes • Admin reskin • Composite fields • Whatever you do tomorrow!

Slide 22

Slide 22 text

@mjtamlyn photocrowd.com