My two cents. I've been trying to do a very similar thing...I've accomplished it in Django....using Formsets....It was painful....the documentation on Formsets is scarce in my opinion and to get them to work is a lot of trial and error, not to mention complexity with corresponding Javascript. At least for me it was. I'm not using the rest framework as it relates to a table and rows but I am using them with a server based Django installation....so I'm not sure how this applies to your use case. I have recently started experimenting with HTMX....to ultimately replace formsets and I'm pretty close to having it figured out. Again with HTMX, there's not a lot of documentation so it's been a ton of trial and error....If any of this resonates with you...let me know and I can provide some more specifics.
Steve
From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf of Antonis Christofides <antonis@antonischristofides.com>
Sent: Sunday, February 27, 2022 12:58 AM
To: django-users@googlegroups.com <django-users@googlegroups.com>
Subject: Re: How to create dynamic models in django??
Sent: Sunday, February 27, 2022 12:58 AM
To: django-users@googlegroups.com <django-users@googlegroups.com>
Subject: Re: How to create dynamic models in django??
Short answer: I don't know. It probably isn't straightforward, but it's doable in principle.
Longer answer: Django hasn't been designed with this case in mind. It's possible it's not the appropriate tool for the job (but again it might be, I don't know). In my experience you should avoid doing such things—it's likely to lead to an unmanageable code mess. Keep it simple. Consider working without a relational database.
Regards,
Antonis
Antonis Christofides +30-6979924665 (mobile)
On 27/02/2022 05.40, Prashanth Patelc wrote:
--How to create dynamic models in django rest framework?--Is there any chance to create dynamic models with APIs
Any examples please send me thanks in advance..
1) Requirement is need create table name and fields in frontend2) we are getting the data and store in to the db create db structure3) get the table name and fields create table in backend &postgresql store to4)this code don't update or add into the models5)store the data into the tables4)get the data into the tables using orm or any raw queries
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMCU6Coop%3DVU67%2B1Ui%2BswvA2xijUYcre%2B%3D-Z_CzLnf-1pRRXUw%40mail.gmail.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/86427c17-5103-2370-2bf4-c951c77b288e%40antonischristofides.com.
No comments:
Post a Comment