如何在Django中使用表单输入创建模型

huangapple go评论45阅读模式
英文:

How can i make models in django with form input

问题

我想创建一个后端服务网站,为此我正在使用django,并希望使用表单输入来创建django模型,如果用户在我的前端创建一个表格,我想在数据库中创建一个表格或模型,我该如何做呢?

你好,栈友们,

我想创建一个后端服务网站,为此我正在使用django,并希望使用表单输入来创建django模型,如果用户在我的前端创建一个表格,我想在数据库中创建一个表格或模型,我该如何做呢?

英文:

I Want to make a backend service website, for that I am working in django and want to make django models but with form input,
if a user create a table in my frontend I want to create a table or model in data base how can i do it?

Hello stackies ,

I Want to make a backend service website, for that I am working in django and want to make django models but with form input,
if a user create a table in my frontend I want to create a table or model in data base how can i do it?

答案1

得分: 0

不,您不能动态创建模型,因为这将需要进行迁移来应用更改。我建议您将客户信息存储在结构化的JSON中,然后可以将其存储在例如PostgreSQL字段中。或者您可以切换到文档型数据库,如MongoDB。

英文:

No, you cannot create models dynamically because this would require migrations to apply the changes.
I'd recommend that you store your customer information in a structured JSON, that you can store in a PostgreSQL field, for example. Or you can jump to a document-based database, such as MongoDB.

huangapple
  • 本文由 发表于 2023年2月9日 01:35:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75389677.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定