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

Re: How to create dynamic models in django??

2022-03-14 Thread Joel Tanko
gt; 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

Re: How to create dynamic models in django??

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

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 tab

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

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

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
@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 in principle. Longer answer: Django hasn't been

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
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

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

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

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

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?

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

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? Wh

Re: Dynamic Models

2017-01-05 Thread Vijay Khemlani
cache "on the fly". >> >> 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 >

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 of dynamic

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
om [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 interface generate the python models? I

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
for 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

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
> > 2017-01-05 19:12 GMT+01:00 Vijay Khemlani <vkhem...@gmail.com>: > > 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 f

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
om>: > 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 >

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 <vkhem...@gmail.com>: > I had to implement dynamic models for our project. > > In the end we represented them in four django models, two for the > "

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

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

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

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,

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

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

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

Re: implementing dynamic models

2015-03-17 Thread Guilherme Leal
gt;>> Not sure if this would work though... >>> >>> Em ter, 17 de mar de 2015 às 08:27, Django User <deva.se...@gmail.com> >>> escreveu: >>> >>> hello, >>>> we are working on an application where users can register new types of >>

Re: implementing dynamic models

2015-03-17 Thread Guilherme Leal
llo, > 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.

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 <dominikan...@gmail.com> 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

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 grou

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

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

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

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

Dynamic Models for CSV Importing

2011-06-20 Thread Andre Terra
e. 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-models/#comment-733 -- You received this message

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 :)

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! > > >

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

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
ls' > > 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 models. Creating models at runtime is a very advance

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

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

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. >>&