TOMToolkit / tom_base

The base Django project for a Target and Observation Manager
https://tom-toolkit.readthedocs.io
GNU General Public License v3.0
26 stars 45 forks source link

Add option to override defaults to converttargetextras #945

Closed rachel3834 closed 3 months ago

rachel3834 commented 4 months ago

Is your feature request related to a problem? Please describe. I am trying to convert the extra parameters for the targets in my existing TOM to attributes on a custom Target model. I've designed the custom Target model and migrated the database, and I am now using the TOM's built-in converttargetextras.py management command.
But instead of changing the extra_param values into Target attributes, the code is skipping all entries. On inspection, this seems to be because the Target attributes have been created with a default value, meaning that they have a valid entry before the management command is run. The command is designed to skip any value which already has an entry.

Describe the solution you'd like The command being designed to skip attributes with existing values is reasonable but the documentation which describes setting up the custom Targets gives examples of defining parameters where default values are given. This means that once the database is migrated, the Target attributes will always be populated with defaults for those parameters where defaults are specified, and the converttargetextra command will always skip those parameters. The command should offer a way for the user to override this behavior if they chose, and the documentation should highlight this more prominently than it currently does.