def extract_panel_definitions_from_model_class(model, exclude=None):
    if hasattr(model, 'panels'):
        return model.panels

    panels = []

    _exclude = []
    if exclude:
        _exclude.extend(exclude)

    fields = fields_for_model(model, exclude=_exclude, formfield_callback=formfield_for_dbfield)

    for field_name, field in fields.items():
        try:
            panel_class = field.widget.get_panel()
        except __HOLE__:
            panel_class = FieldPanel

        panel = panel_class(field_name)
        panels.append(panel)

    return panels
dataset/ETHPy150Open torchbox/wagtail/wagtail/wagtailadmin/edit_handlers.py/extract_panel_definitions_from_model_class