Skip to Content
Django 3 Web Development Cookbook - Fourth Edition
book

Django 3 Web Development Cookbook - Fourth Edition

by Aidas Bendoraitis, Jake Kronika
March 2020
Intermediate to advanced
608 pages
17h 17m
English
Packt Publishing
Content preview from Django 3 Web Development Cookbook - Fourth Edition

How it works...

The MP_Node abstract model provides the path, depth, and numchild fields, as well as the steplen, alphabet, and node_order_by attributes, to the Category model as necessary for constructing the tree:

  • The depth and numchild fields provide metadata about a node's location and descendants.
  • The path field is indexed, enabling database queries against it using LIKE to be very fast.
  • The path field is made up of fixed-length encoded segments, where the size of each segment is determined by the steplen attribute value (which defaults to 4), and the encoding uses characters found in the given alphabet attribute value (defaults to Latin alphanumeric characters).

The path, depth, and numchild fields should be treated as read-only. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Django 2 Web Development Cookbook - Third Edition

Django 2 Web Development Cookbook - Third Edition

Jake Kronika, Aidas Bendoraitis

Publisher Resources

ISBN: 9781838987428Supplemental Content