How are fields added to the table in the backend?

Hi,
We would like to understand how the fields are added to a table in the backend using Django. As the tables and fields are created on the go and new fields can be added from front-end, how are the fields added to the backend? Is it added to the models.py file? If yes, where can we find it.

Thanks.

Hi @alucor-it ,

We have a blog post describing how we do this here How Baserow lets users generate Django models on the fly // Baserow.

We don’t modify any files, we instead have metadata tables like database_field where we add a row representing the new field and then we literally add a SQL column to the database table used to store a particular tables rows.

1 Like

Thank you for the quick reply. We’ll go through the blog.

Is there a link on how to implement this in a fresh django project? I’m trying to understand how it works.

Thanks

Just to check, what do you mean by “it”? The way Baserow dynamically generates models? We don’t provide any tutorial on how to set this up in a fresh django project, you are going to have to look at our codebase to understand it further (TableHandler, Table, Table.get_model etc).

Possibly a better question, what are you trying to achieve fundamentally?