wagtail / django-modelcluster

Django extension to allow working with 'clusters' of models as a single unit, independently of the database
BSD 3-Clause "New" or "Revised" License
485 stars 66 forks source link

Allow fields to be explicitly excluded from serialization/deserialization #193

Open ababic opened 1 month ago

ababic commented 1 month ago

Rationale

It's very common in Wagtail projects to have models with fields that fall into both categories of:

  1. Fields that are revised by editors
  2. Fields that are managed automatically by signals or some other background process, and are meaninful to the object as a whole.

Always including every field in the serialization/deserialization process adds unnecessary overhead in cases where a model's with_content_json() method will override the value anyway. There's practically zero value in having these values be included in revision content either, as they will always be ignored, and just adds to the overhead of loading/converting revision content from the database.