»Building a custom model field from the ground up«
2019-04-12, 11:30–12:00, Main hall

A comprehensive guide on building custom models fields in Django. Including descriptors, lookups, expressions and many more.

Often you need to map domain entities onto your application and store them in a database. Django provides you with a very extensible API that allows you to integrate domain entities with ORM seamlessly. This talk will walk through all essential steps in building a Money instances support for Django from the ground, based on real-life examples taken from django-money library.

Here is an overview of the talk structure:

Historical notes on django-money project.

Implementing a field for Money

  • Connecting py-moneyed with Django. Map Money to Model
  • What field to choose?
  • Implicit currency field
  • How descriptors could help here?

Querying MoneyField

  • Designing the API
  • Lookup API vs. old style model managers surgery
  • Expressions. Enhancing Money class

Extras:

  • Integrating Django admin. Utilizing AppConfig.ready
  • Serialization
  • Validators
  • Migrations. Deconstruction & backends differences
  • Testing

Slides: http://slides.com/stranger6667/building-a-custom-model-field-from-the-ground-up#/

See also: Slides for the presentation