If I understand correctly you're trying to give the user the power to
create tables from the front end by saving his params to the database and
using that data to create a table in another or the same  database, I tried
doing the same with forms here's a tweak, hope it's what you're looking for
or at least a step in the right direction.

#models.py


Model = models.Model

class DynamicModel(Model):
    name = models.CharField(max_length=100)
    fields = models.ManyToManyField("Field", blank=True)

    def get_data(self, **kwargs) :
        # you'd probably want to do some
           kind of db query here to postgres
        using a Python wrapper.
       #... cursor.execute("select * from %s" % self.name)
      # assuming that you've instantiated a postgres db cursor

class Field(Model):
     name = models.CharField(max_length=100)
     field_type = models.CharField(max_length=100,
    choices=(("integer", "Integer"), ("char", "char" ) )






On Fri, Mar 11, 2022, 6:51 AM Derek <gamesb...@gmail.com wrote:

> I'm not quite sure how these requirements have arisen as you have not
> provided any context as to the actual user or business needs.  In my
> experience,  most businesses and science organisations  understand very
> clearly what kinds of data they need to store and what they need to do with
> that data.   This makes it possible for the developers to design and
>  implement well-structured SQL  databases.
>
> If,  for some reason, this is really not your use case then, as the other
> commenters have suggested,  it's likely that Django is not a good fit for
> your needs.  Perhaps you should consider a NoSQL  solution (
> https://www.mongodb.com/nosql-explained/when-to-use-nosql) instead;  and
> explore the use of  its associated technologies which can meet your stated
> requirements.
>
> On Thursday, 10 March 2022 at 01:55:18 UTC+2 Ryan Nowakowski wrote:
>
>> On Sun, Feb 27, 2022 at 09:10:05AM +0530, 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 frontend
>> > 2) we are getting the data and store in to the db create db structure
>> > 3) get the table name and fields create table in backend &postgresql
>> store
>> > to
>> > 4)this code don't update or add into the models
>> > 5)store the data into the tables
>> > 4)get the data into the tables using orm or any raw queries
>>
>> The WQ project uses the Entity-Attribute-Value data model:
>>
>> https://v1.wq.io/1.2/docs/eav-vs-relational
>>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a02e1d2a-b640-4b5e-ba65-bebcba8de66an%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a02e1d2a-b640-4b5e-ba65-bebcba8de66an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJ4Kmg49Ei2CubpQjHzEkOXa4uHJnJN1VPUved1MOvk50XzXTw%40mail.gmail.com.

Reply via email to