Introduce new component from eesyplan#492
Draft
Bachibouzouk wants to merge 5 commits into
Draft
Conversation
Inherting from Asset might be preferable, as the class remain a child of Asset, one can always use Asset.objects.filter(asset_type=...)
The ModelForm is instanciated with a Meta class referring to the specific asset model if differing from Asset. Currently problems remain at the export to datapackage and export scenarios
b3b2e5d to
fd1cf09
Compare
Author
|
Now export of the scenario produces an error but only when the scenario is reimported and the special component clicked |
The new asset specific fields are successfully exported
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PROTOCOL (option a or b)
a) write a new class which inherits from Asset with the new needed fields
b) add the fields within the Asset class
add an asset_type for this new component with their visible fields (under static/resources/assettypes_list.csv)
add the asset to the drag and drop within the
projects/views.py::scenario_create_topologyfunction. Right at the beginning there is a dict namedcomponentswith asset_type as keys and the verbose name as ValueAt this stage the component will be visible within the GUI and can be dragged to the energy system. However option a) doesn't provide out of the box access to the component's fields, whereas option b) does.
To change this one need to be able to set the
modelattribute of the Meta class to something else than Asset (ie a decorator function which would find the new asset's Model from a dict and return a CreateAssetForm instance with modifiedMeta