Login

Snippets by wapcaplet

Snippet List

A slightly better YAML serializer

I find Django's default YAML serializer output too repetitive, so I came up with this customized version that avoids outputting the model name for every single object, and makes the primary key into an index for the object's fields. This allows many simple model instances to be serialized as one-liners. See the module docstring for additional explanation and usage notes.

  • yaml
  • serializer
  • deserializer
Read More

wapcaplet has posted 1 snippet.