Djangocon: a different form of navigation - Chaim Kirby

Tags: djangocon, django

(One of my summaries of a talk at the 2018 european djangocon.)

We use forms a lot. He’s not going to talk about regular forms, but about using forms for navigation.

Many people have lots of data nowadays. Or have to work with it. Or have to program code for people that work with lots of data. Chaim works in healthcare. He showed a demo of riskscape: 150GB, 130 million records, 47 fields.

The demo showed a form where you could select a few criteria (“only give me people with type 2 diabetes”) and pick an action (show number of cases on a map). Then it started to get interesting. Click on an area and then create a graph according to age group.

You could also click several items on the homepage that resulted in a map or graph with a pre-populated selection.

Technically:

  • A form’s data propagates through pages.
  • You can pre-populate a form so that you can use it as an URL (from a dashboard, for instance).

This is done with django-modelqueryform. It generates forms that act as a power search based on a model’s Meta.

To carry the form context between pages you have to render the form on all pages. Hidden is OK. You need four lines of javascript that sends the hidden form when you submit the visible form.

Forms can be serialized. Effectively, you get keys/values out of a form’s POST. You can put that into a dict into some constant in your code and use that when you click a certain link. Or you can store it in the database (allowing your users to create their own links).

Back to his demo, with the 130 million records: those records are only updated once per month. So… he can pre-calculate and cache the query results. Similarly, you can look at queries that are used a lot and pre-calculate them once the data is updated.

His slides and talk are at https://github.com/ckirby/djangocon-eu_2018

https://abload.de/img/screenshot2018-03-16adtoqj.png

Photo explanation: fitting roofs has to happen on-site when there are lots of angles

blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):