update_model
- specatalog.crud_db.update.update_model(entry, update_data)[source]
Update a database entry using an update model. The entry is updated and commited. In case of multicomponent molecules the name is updated automatically using the components.
- Parameters:
entry (TimeStampedModel) – Any object from the models.base.TimeStampedModel (=sqlalchemy model) class or from a subclass. The entry is updated.
update_data (update_model_type) – Update model. The fields that are set determine which fields of the entry are updated. The type of the update_data model should fit the type of the entry. E.g. if the entry is an object of the class TREPR, the update_data should be an object of the class TREPRUpdate.
- Raises:
ValueError – An error is raised if the update model contains attributes that are not part of the database entry.
- Return type:
None.