Dynamic models

2023-05-22 Thread ruth salvatore
Here I am creating django dynamic models but for getting data i am using get method but i am not getting data it just says that table does not exist even if it is present. from django.http import JsonResponse from.serializers import CreateTableSerializer from django.db import connection

How to use the MigrationAutodetector manually for dynamic models

2022-08-08 Thread Diederik van der Boor
Hi All, I'm working on an API-server project that uses dynamically generated Django models, so it can service many user-provided datasets. To ease maintenance work, we'd like to generate the SQL statements to migrate database tables to a newer version of the schema. I've managed to use the inte

Re: How to create dynamic models in django??

2022-03-14 Thread Joel Tanko
en-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: >> >

Re: How to create dynamic models in django??

2022-03-10 Thread Derek
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

Re: How to create dynamic models in django??

2022-03-09 Thread Ryan Nowakowski
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

Re: How to create dynamic models in django??

2022-02-28 Thread Clive Bruton
On 28 Feb 2022, at 16:24, Prashanth Patelc wrote: Any example? Just read the django-extra-views documentation. Essentially a formset can be as simple to use as any of the built-in class-based views, eg: from extra_views import InlineFormSetView class EditContactAddresses(InlineF

Re: How to create dynamic models in django??

2022-02-28 Thread Prashanth Patelc
Any example? On Mon, Feb 28, 2022, 5:27 PM Clive Bruton wrote: > > On 27 Feb 2022, at 17:54, Steve Smith wrote: > > > ...the documentation on Formsets is scarce in my opinion and to get > > them to work is a lot of trial and error... > > To massively simplify formsets try django-extra-views > >

Re: How to create dynamic models in django??

2022-02-28 Thread Clive Bruton
On 27 Feb 2022, at 17:54, Steve Smith wrote: ...the documentation on Formsets is scarce in my opinion and to get them to work is a lot of trial and error... To massively simplify formsets try django-extra-views -- Clive -- You received this message because you are subscribed to the Googl

Re: How to create dynamic models in django??

2022-02-27 Thread Shaheed Haque
Check out the api mentioned here https://stackoverflow.com/questions/34768732/temporary-models-in-django#48042468 On Sun, 27 Feb 2022, 03:42 Prashanth Patelc, wrote: > How to create dynamic models in django rest framework? > Is there any chance to create dynamic models with APIs &

Re: How to create dynamic models in django??

2022-02-27 Thread Steve Smith
From: django-users@googlegroups.com on behalf of Antonis Christofides Sent: Sunday, February 27, 2022 12:58 AM To: 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

Re: How to create dynamic models in django??

2022-02-27 Thread Heman Okumbo
Refer here.https://docs.djangoproject.com/en/4.0/topics/db/models/ On Sun, Feb 27, 2022, 06:42 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 adv

Re: How to create dynamic models in django??

2022-02-26 Thread Antonis Christofides
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

How to create dynamic models in django??

2022-02-26 Thread Prashanth Patelc
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

Re: Dynamic Models

2017-01-10 Thread Guilherme Leal
Well, some more context then: I've worked at a company that have exactly the same logic writen in perl and using an ORM built inside the company. The ideia was to build a plataform to interact with the DB, and with this interaction, extend the information about the table been created/modified or t

Re: Dynamic Models

2017-01-10 Thread Jani Tiainen
Problem, as you see is that Django is build for static models. So if you have a dynamic model, how would you construct (efficient) queries in your other views unless you know the structure of the data? Well you kind of can't since there is no structure. Also, what purpose would such a models s

Re: Dynamic Models

2017-01-10 Thread Guilherme Leal
@Jani Tiainen I really like Django ORM, and will make everything possible to keep it. I think that losing the ORM will make things harder in the big picture because it would make the logic built by the developers a lot more error prone and not "database agnostic" (at least as far as thedatabases ba

Re: Dynamic Models

2017-01-09 Thread Jani Tiainen
Hi, You're probably after EAV pattern (or anti-pattern depending who you ask). Implementing that in Django is relatively trivial, though with any kind of dynamics you'll going to loose most of the ORM goodies. This kind of leads to question that is Django ORM really needed for you at all? Ho

Re: Dynamic Models

2017-01-06 Thread Guilherme Leal
@Michal Petrucha That was one of the insights that I've been wanted. One way or another I will try, but will keep in mind these points. Thank you! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
ango-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Vijay Khemlani Sent: Thursday, January 5, 2017 4:00 PM To: django-users@googlegroups.com Subject: Re: Dynamic Models "That was exacly the points i'm willing to avoid. Had any problems with the metaclass approach? W

Re: Dynamic Models

2017-01-05 Thread Vijay Khemlani
t;. >> >> Guilherme Leal > > Hi Guilherme, > > I kinda got lost deeper in the reply chain in this thread, but > regarding the original question, have you had a look at > https://djangopackages.org/grids/g/dynamic-models/ ? django-mutant, in > particular, seems to

Re: Dynamic Models

2017-01-05 Thread Michal Petrucha
had a look at https://djangopackages.org/grids/g/dynamic-models/ ? django-mutant, in particular, seems to be quite close to what you're asking for. Even if it's not a direct solution for you, you might be able to take a lot of inspiration from there. However, keep in mind that any kind o

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Guilherme Leal Sent: Thursday, January 5, 2017 1:06 PM To: django-users@googlegroups.com Subject: Re: Dynamic Models @Matthew Pava >Going down that route, we would basically be developing an IDE for Django >models Well, th

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
@ > googlegroups.com] *On Behalf Of *Guilherme Leal > *Sent:* Thursday, January 5, 2017 12:28 PM > *To:* django-users@googlegroups.com > *Subject:* Re: Dynamic Models > > > > @*ludovic coues* > > Like what? let the interface generate the python models? I thought about >

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
Python including its models, though it’s not Django. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Guilherme Leal Sent: Thursday, January 5, 2017 12:28 PM To: django-users@googlegroups.com Subject: Re: Dynamic Models @ludovic coues Like what? let the

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
19:12 GMT+01:00 Vijay Khemlani : > > I had to implement dynamic models for our project. > > > > In the end we represented them in four django models, two for the > > "virtual models" and its fields and two for the actual data > > > > We used th

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
@Vijay Khemlani - No ORM unless you implement it - No DB integrity checks That was exacly the points i'm willing to avoid. Had any problems with the metaclass approach? Why did you chose the "virtual model" concept? 2017-01-05 16:12 GMT-02:00 Vijay Khemlani : > I had to implem

Re: Dynamic Models

2017-01-05 Thread ludovic coues
Would it work if the interface provide a download for a bunch of models.py file ? 2017-01-05 19:12 GMT+01:00 Vijay Khemlani : > I had to implement dynamic models for our project. > > In the end we represented them in four django models, two for the > "virtual models" and

Re: Dynamic Models

2017-01-05 Thread Vijay Khemlani
I had to implement dynamic models for our project. In the end we represented them in four django models, two for the "virtual models" and its fields and two for the actual data We used the django model system for these four base classes, but the "virtual models" on top of the

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
I know metaclasses, and i know that the django models uses some "meta class magic" to register the models on the model cache. I gess i need to test the implication of refreshing the model cache on the fly, since it doesn't have a "natural" way to refresh itself. 2017-01-05 14:05 GMT-02:00 Avraham

Re: Dynamic Models

2017-01-05 Thread Avraham Serour
you should read about metaclasses, basically it enables you to build class definitions in runtime. http://stackoverflow.com/questions/13/what-is-a-metaclass-in-python On Thu, Jan 5, 2017 at 6:02 PM, Guilherme Leal wrote: > The "migrations on the fly" thing dont get to be a problem (since I

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
The "migrations on the fly" thing dont get to be a problem (since I gess we could call the migrations api to generate the migration). My concenrs would be contructing and refreshing the model cache (I say the "model cache" like the list accessed through django.apps.get_models() ), and the OBVIOUS p

Re: Dynamic Models

2017-01-05 Thread Beautifulloop
I think you just need to define a generic model. I dont see how what you are asking is feasible since it would require that (on the fly that migrations are made). You can write a generic model where the types can be represented by a field name. On Thursday, 5 January 2017 17:33:07 UTC+2, Guilh

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
My idea was to build an user interface for the model definition, so the developer (or in this case, the user) could define the model using a register form. Like a user interface to define the model layer, I gess. 2017-01-05 12:34 GMT-02:00 Avraham Serour : > I guess you could play with metaclass

Re: Dynamic Models

2017-01-05 Thread Avraham Serour
I guess you could play with metaclasses and generate the class definition on runtime using information from the database But why? You can save the model definition on files, why saving them to database and complicate your life? On Wed, Jan 4, 2017 at 10:38 PM, Guilherme Leal wrote: > Is there a

Dynamic Models

2017-01-04 Thread Guilherme Leal
Is there a way to populate Django model cache on the fly? I was thinking about saving the model definition on some backend (database for instance) and loading as needed. This way we can basically build a custom admin interface for the model definitions, and load the models (through "type()" or some

Re: implementing dynamic models

2015-03-17 Thread Guilherme Leal
gt;>> Em ter, 17 de mar de 2015 às 08:27, Django User >>> escreveu: >>> >>> hello, >>>> we are working on an application where users can register new types of >>>> data streams through Django. so it requires a mechanism to create new >&

Re: implementing dynamic models

2015-03-17 Thread Django User
w types of >>> data streams through Django. so it requires a mechanism to create new >>> tables (cassandra) on the fly. what is the best Djangoish way to implement >>> such dynamic models? pls. let us know. thanks in advance. >>> >>> -- >>>

Re: implementing dynamic models

2015-03-17 Thread Guilherme Leal
register new types of >> data streams through Django. so it requires a mechanism to create new >> tables (cassandra) on the fly. what is the best Djangoish way to implement >> such dynamic models? pls. let us know. thanks in advance. >> >> -- >> You rece

Re: implementing dynamic models

2015-03-17 Thread Guilherme Leal
cation where users can register new types of > data streams through Django. so it requires a mechanism to create new > tables (cassandra) on the fly. what is the best Djangoish way to implement > such dynamic models? pls. let us know. thanks in advance. > > -- > You received this

implementing dynamic models

2015-03-17 Thread Django User
hello, we are working on an application where users can register new types of data streams through Django. so it requires a mechanism to create new tables (cassandra) on the fly. what is the best Djangoish way to implement such dynamic models? pls. let us know. thanks in advance. -- You

Re: What are the best examples of the use of Dynamic Models? (real situation)

2013-06-08 Thread Russell Keith-Magee
On Sat, Jun 8, 2013 at 2:11 AM, enemytet wrote: > I learn dynamic models in Django but I don't understand when to use them. > > What are the best examples of the use of dynamic models? (real situation) > My advice - Don't. Ever. If you find yourself in a situation where

What are the best examples of the use of Dynamic Models? (real situation)

2013-06-07 Thread enemytet
I learn dynamic models in Django but I don't understand when to use them. What are the best examples of the use of dynamic models? (real situation) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: Dynamic Models for CSV Importing

2013-04-15 Thread Max Demars
Hello André, I wonder if you successfuly found a way to achieve what you were talking in this post. Actually, I am looking for something similar. Instead of uploading .csv my app would allow users to upload shapefile. I am reading about dynamic models but the doc is scarce. If you can share a

Creating Dynamic Models

2012-06-11 Thread Karandeep Nagra
Hi, New user to Django. I have a class 'Server' and I want to set up my Django site so that when a server is added through the admin interface, an additional model along with its admin.ModelAdmin class are added. So say a server 'Crushinator' is added to the database of servers. At its creat

Re: Dynamic Models for CSV Importing

2011-06-20 Thread Andre Terra
Thanks for the quick reply, Shawn! The reason I wanted to use Django was so that I could leverage the ORM to allow users to do arbitrary SQL filtering/grouping before the data gets saved onto the production DB. Assuming a 1.5 million lines CSV file (which is probably the smallest file users would

Re: Dynamic Models for CSV Importing

2011-06-20 Thread Shawn Milochik
I don't see where Django comes in -- at least not for the core of the app. Python certainly, with the xlwt and xlrd modules being incredibly helpful. Secondly, I'd use MongoDB (via pymongo) to store the temporary data, because I wouldn't bet a nickel that you'll get data in a consistent forma

Dynamic Models for CSV Importing

2011-06-20 Thread Andre Terra
the results of a query to the permanent table. I'd really appreciate any help you can give me at all. Thank you in advance Sincerely, André Terra (airstrike) [1] https://code.djangoproject.com/wiki/DynamicModels [2] http://family.ubuntu-fl.org/mhall/fun-with-django-meta-classes-and-dynamic-m

Re: Creating dynamic models?

2009-11-26 Thread Kevin Renskers
Hi Matthias , Thank you, I went for option 1 and it works perfectly! Funny, the add_to_class function basically does "setattr(cls, name, value)". So I had the right solution, only you have to do this after class creation, not inside its __init__ function. Good to know, will blog about this :) Ag

Re: Creating dynamic models?

2009-11-26 Thread Matthias Kestenholz
On Thu, Nov 26, 2009 at 9:56 AM, Kevin Renskers wrote: > Just a small update: the DynamicModels way as described on the wiki > doesn't work (it also says that it only works in Django 0.96, so > yeah..). > > If anyone has any idea how to do this, I would be very thankful! > > > On Nov 24, 2:35 pm,

Re: Creating dynamic models?

2009-11-26 Thread Kevin Renskers
Just a small update: the DynamicModels way as described on the wiki doesn't work (it also says that it only works in Django 0.96, so yeah..). If anyone has any idea how to do this, I would be very thankful! On Nov 24, 2:35 pm, Kevin Renskers wrote: > Hi all, > > In my Django project I want to h

Creating dynamic models?

2009-11-24 Thread Kevin Renskers
Hi all, In my Django project I want to have a model that is dynamically created. I tried using the __init__ function for this, something like so: fields = ['field_a', 'field_b', 'field_c'] class MyModel(models.Model): def __init__(self, *args, **kwargs): for field in fields:

Re: Dynamic models keyError

2008-07-04 Thread Malcolm Tredinnick
ror > 'project.src.app.models' > > Any ideas what I am doing wrong. Quite seriously, if you're not able to debug this sort of error yourself, given the source code for create_model() and the internals of Django it calls, then you probably shouldn't be creating dynamic mo

Dynamic models keyError

2008-07-04 Thread mwebs
Hello, I am trying to generate models at runtime. For this purpose I am using the method create_model() provided at http://code.djangoproject.com/wiki/DynamicModels create_model(name, fields, module='app.models' ) When I am doing like this i get a keyError '__module__' then I tried to pass the

Re: Dynamic Models

2008-01-11 Thread Marty Alchin
On Jan 11, 2008 10:39 AM, WoonZai <[EMAIL PROTECTED]> wrote: > >>> model = create_model('Empty') > Traceback (most recent call last): > File "", line 1, in > File "/Users/../models.py", line 36, in create_model > return type(UserForm, (models.Model,), attrs) > File "/.../site-packages/d

Dynamic Models

2008-01-11 Thread WoonZai
Hi, I was trying to follow the example on Dynamic Models over here but it didn't work for me. [http://code.djangoproject.com/wiki/ DynamicModels] I copied the code for def create_model in the file models.py, and when I try to create a model in the shell, I have the following errors. >