denshoproject / ddr-cmdln

Command-line tools for automating the Densho Digital Repository's various processes.
Other
0 stars 2 forks source link

Refactor OBJECT.save #113

Closed gjost closed 5 years ago

gjost commented 5 years ago

The DDR.models.OBJECT.save() code was originally in ddr-local -- the Django part of the DDR application. It still reflects this, requiring a cleaned_data argument. Django's cleaned_data var is a complicated thing with its own var names (id_title instead of title) and includes things like the field inheritance markers (id_status_inherit). This makes it difficult to reason about, difficult to work with DDR objects in the Django shell, and difficult to unit-test. Field inheritance is even harder to work with outside the web UI.

DDR.models.OBJECT.save() should no longer require cleaned_data. Instead ddr-local's webui.models.OBJECT.save() should take cleaned_data, set the object's attributes, and call OBJECT.save() with just a list of fields to be inherited.

gjost commented 5 years ago

Completed in commit d8397ab.