comic / grand-challenge.org

A platform for end-to-end development of machine learning solutions in biomedical imaging
https://grand-challenge.org
Apache License 2.0
168 stars 50 forks source link

Archive Item Titles #3345

Closed chrisvanrun closed 1 month ago

chrisvanrun commented 1 month ago

Part of the pitch:

This is a copy of what was done for Display Items. I've opted to abstract the CIV set creation and update form data processing into CIVSetCreateViewMixin and CIVSetCreaViewMixin respectively as to stay DRY.

chrisvanrun commented 1 month ago

The Django test seemed to fail randomly on not being able to find the PrefixConverter. I assume it has to do with dependency differences on main vs this branch.

Merging main and re-running.

chrisvanrun commented 1 month ago

The Django test seemed to fail randomly on not being able to find the PrefixConverter. I assume it has to do with dependency differences on main vs this branch.

Merging main and re-running.

Well, Chris of the past, that worked!

chrisvanrun commented 1 month ago

Draft, since I am in the middle of a refactor.

chrisvanrun commented 1 month ago

Heavy refactor. I've now pushed the processing of the data into the forms, leaning more heavily on the model's definition of civ_set. I think this is the DRY-est it has been.

For instance, the forms for DisplaySet creating and updating are now an interesting mix of Mixins:

class DisplaySetCreateForm(
    DisplaySetFormMixin,
    UniqueTitleCreateFormMixin,
    CIVSetCreateFormMixin,
    MultipleCIVForm,
):
    pass

class DisplaySetUpdateForm(
    DisplaySetFormMixin,
    UniqueTitleUpdateFormMixin,
    CIVSetUpdateFormMixin,
    MultipleCIVForm,
):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        if not self.instance.is_editable:
            for _, field in self.fields.items():
                field.disabled = True