Django 1.11 Adds Easier Database Indexes

Datetime:2017-04-15 05:21:50         Topic: DataBase  Django          Share        Original >>
Here to See The Original Article!!!

Django 1.11 Adds Easier Database Indexes
Written by Kay Ewbank
Friday, 14 April 2017

Django, the high-level Python Web framework that lets you create dynamic websites, has added new classes to make it easier to create database indexes.

Django 1.11 has been designated as a long-term support release, which means that it will receive security updates for at least three years after its release.

The improvements for database indexes come from a new django.db.models.indexes module  that has classes for index creation. You can create composite and custom indexes for databases to optimize databases queries and to speed up the response time from databases. The Index class creates a b-tree index, as if you used d b_index on the model field or index_together on the model Meta class.

Another addition is support for Template-based widget rendering to make it easier to customize form widgets. The form rendering process can be customized at several levels:

  • Widgets can specify custom template names.
  • Forms and widgets can specify custom renderer classes.
  • A widget’s template can be overridden by a project. (Reusable applications typically shouldn’t override built-in templates because they might conflict with a project’s custom templates.) 

Other improvements are aimed at working with data. You can now use subquery expressions to create explicit subqueries using the ORM, avoiding the need to drop into raw SQL. You can also add an explicit subquery to a QuerySet using the Subquery expression.

If you want to reference columns from an outer query in a queryset, there's now an OuterRef option that lets you reference a specific field.

There's also a new Exists qualifier. This is a Subquery subclass that uses an SQL EXISTS statement to find out whether there's a matching row in a subquery. In many cases this should perform better than a subquery since the database is able to stop evaluation of the subquery when a first matching row is found.

More Information

Django Release Notes

Related Articles

Django 1.3 released

Komodo 10.2 Adds Slack Sharing

To be informed about new articles on I Programmer, sign up for ourweekly newsletter,   subscribe to the RSS feedand follow us on,  Twitter, FacebookGoogle+ or  Linkedin .

Top 10 From Around The Web: Ruby On Rails Resources


The I-Programmer team reports a lot of news and originates loads of helpful articles, but there's far more out there than we can possibly cover. So from time to time we trawl through other people's bl [ ... ]

+ Full Story

On the Unhappiness of Software Developers


It is tough being a programmer - you have to put up with so much stuff from people who aren't programmers and even other programmers turn up and spoil your wonderful code. Is there enough that is posi [ ... ]

+ Full Story

More News

blog comments powered by Disqus

Last Updated ( Friday, 14 April 2017 )

Follow @Iprogrammerinfo

RSS feed of news items only

Copyright © 2017 All Rights Reserved.

Joomla! is Free Software released under the GNU/GPL License.