Possibility to extend native field type with a plugin

Hi. Is it an expected way to use plugins in order to extend baserow native field types? I’ve tried to create a custom field type and in this case everything is fine but once I try to extend a native one I have a type issue. My goal is to extend link row with some new properties and I’ve tried to extend model and use it for the field type but it does not work. It would be nice to understand possibility of doing something like this with the current baserow architecture. Thanks in advance.

Hi @dpetrenko!

Can you share with us the code that you used to modify the link row field? Perhaps the problem could be some existing relationships in the db?

There is a new model for the LinkRowFiled

from baserow.contrib.database.fields.models import LinkRowField
class CustomLinkRowField(LinkRowField):
    property = models.BooleanField(default=False)

There is a redefined LinkRowFieldType

class LinkRowFieldType(LinkRowFieldType):
    type = 'link_row'
    model_class = CustomLinkRowField

The old field type was unregistered and customized one was registered

field_type_registry.unregister("link_row")
field_type_registry.register(LinkRowFieldType())

What is the error that you get?

Perhaps, also, can you describe why you are doing that? What are you trying to achieve?

Maybe there are alternative solutions to your problem than replacing the model and native field type.

@dpetrenko you are probably hitting problems as our core Baserow code is various places is not using the LinkRowFieldType.model_class but instead the LinkRowField model class directly.

I’d be very happy to review/test any MR on our core codebase making such a change to use LinkRowField -> field_type_registry.get(LinkRowFieldType.type).model_class!

One workaround you could do is monkeypatch the LinkRowField class itself on startup with your own somehow? Or perhaps bolt on your extra properties directly and not make a custom model?

How about forking the link row fieldtype into your plugin, would that work ?