Re: Dynamic model fields using mysql?

2018-07-03 Thread hanleybrand
One question I'd ask would be why you wouldn't just save the files either on disk or even in the database (using the BLOB datatype) if it absolutely had to be in the database... then if you needed to manipulate/display/read them at a later date you would just load the files in question. If

Re: Dynamic model fields using mysql?

2018-07-02 Thread hardik dadhich
it means that I can't do it on MySQL database! should I change the DB type and if so which one should I prefer! Postgres or NoSQL? On Tuesday, July 3, 2018 at 3:20:40 AM UTC+5:30, Melvyn Sopacua wrote: > > On maandag 2 juli 2018 21:33:35 CEST hardik dadhich wrote: > > > > > Can anyone tell me

Re: Dynamic model fields using mysql?

2018-07-02 Thread Jason
or you can move to postgres and take advantage of the jsonfield integration with django. On Monday, July 2, 2018 at 3:48:46 PM UTC-4, hardik dadhich wrote: > > Hello, > Can anyone tell me how can I make dynamic Django model fields? I mean to > say that I want to save excel file data in Django

Re: Dynamic model fields using mysql?

2018-07-02 Thread Melvyn Sopacua
On maandag 2 juli 2018 21:33:35 CEST hardik dadhich wrote: > Can anyone tell me how can I make dynamic Django model fields? I mean to > say that I want to save excel file data in Django model using MySQL. and > excel column can vary. The user can upload 100 column table or he can be > upload 1000

Dynamic model fields using mysql?

2018-07-02 Thread hardik dadhich
Hello, Can anyone tell me how can I make dynamic Django model fields? I mean to say that I want to save excel file data in Django model using MySQL. and excel column can vary. The user can upload 100 column table or he can be upload 1000 column table in the database. so it is possible to add

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Roman Akopov
I have investigated a bit more and looks lite it is Options._relation_tree property, it's value is calculated by _populate_directed_relation_graph only once and it is @cached_property, so I see no valid way to reset value On Tuesday, September 5, 2017 at 4:40:02 PM UTC+4, Michal Petrucha wrote:

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Roman Akopov
._meta._expire_cache()" > > call almost everywhere, before generating dynamic model, after, between > > steps, it did not help a bit, error is exactly the same. > > Also, I have additionally tested my application against django 1.10 and > > django 1.9 and got exactly the same re

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Michal Petrucha
On Tue, Sep 05, 2017 at 04:56:10AM -0700, Roman Akopov wrote: > Unfortulately, it did not help. I have added "model._meta._expire_cache()" > call almost everywhere, before generating dynamic model, after, between > steps, it did not help a bit, error is exactly the s

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Roman Akopov
Unfortulately, it did not help. I have added "model._meta._expire_cache()" call almost everywhere, before generating dynamic model, after, between steps, it did not help a bit, error is exactly the same. Also, I have additionally tested my application against django 1.10 and django 1.9 and

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Michal Petrucha
On Tue, Sep 05, 2017 at 03:47:37AM -0700, Roman Akopov wrote: > Hello, > > My problem is very rare so I'll try ad add as much useful detail as > possible. > > I am using python 3.5 and 3.6, Django 1.11.4 > > I am creating complex security related application and need to generate > additional

Dynamic model, reverse foreign key not working

2017-09-05 Thread Roman Akopov
Hello, My problem is very rare so I'll try ad add as much useful detail as possible. I am using python 3.5 and 3.6, Django 1.11.4 I am creating complex security related application and need to generate additional models based on other applications' models. In general, everything works fine,

Re: Dynamic Model ID cannot be called

2017-07-26 Thread Shazia Nusrat
Thank you it worked. Much appreciated. Regards, Shazia On Wed, Jul 26, 2017 at 5:47 AM, M Hashmi wrote: > Nothing wrong with your function based view. Just try to fill data in DB > field. It will work. Because you don't have any record in DB. Try to use >

Re: Dynamic Model ID cannot be called

2017-07-26 Thread M Hashmi
Nothing wrong with your function based view. Just try to fill data in DB field. It will work. Because you don't have any record in DB. Try to use 'get_or_create' function. M On Wed, Jul 26, 2017 at 4:50 AM, Shazia Nusrat wrote: > Hi, > > I have a simple model like

Dynamic Model ID cannot be called

2017-07-26 Thread Shazia Nusrat
Hi, I have a simple model like below: class Artists(models.Model): name = models.CharField(max_length=200) description = models.TextField() def __unicode__(self): return self.name I am trying to call it in my view like below: def artistdetail(request, id):

Re: Dynamic Model Saving and Admin Activation

2012-06-14 Thread Daniel Roseman
On Wednesday, 13 June 2012 21:46:27 UTC+1, Karandeep Nagra wrote: > > So I've set up my Django site to create a dynamic model for every Server > that is created. So at the creation of server Bender, the model > Bender_request is created. But whenever I restart the bui

OneToOneField in "Dynamic Model" referencing another dynamic model.

2010-07-18 Thread Massimiliano della Rovere
greetings. I am using the admin interface to show data retrieved by a collector process and put in a different table for each source; each source is identified by "cliente", "num1" and "num2". At run time django scans the db for tables with proper names and builds classes modeled from an abstract

Re: Dynamic Model and ModelAdmin based on tables in db

2010-04-30 Thread akonsu
hello, may be this will be useful: http://code.djangoproject.com/wiki/DynamicModels On Apr 22, 5:53 am, Massimiliano della Rovere wrote: > An external process creates tables whose names follow the pattern > "collector_XYZ"; all the tables will have the very

Dynamic Model and ModelAdmin based on tables in db

2010-04-22 Thread Massimiliano della Rovere
An external process creates tables whose names follow the pattern "collector_XYZ"; all the tables will have the very same structure. For each table I need to create a matching django.db.models.Model and django.admin.models.ModelAdmin, dynamically, because over time new tables will be created and

Re: Dynamic Model

2010-02-11 Thread Andy Mikhailenko
Hi Sameer, > is it possible to build a dynamic model in run-time in version 1.1 ? What do you mean by "dynamic"? If you need to define arbitrary attributes in runtime *and* be able to save them correctly in a RDBMS *and* be able to restore the object from the DB *and* be able to

Re: Dynamic Model

2010-02-11 Thread Dennis Kaarsemaker
On do, 2010-02-11 at 15:51 +0330, Sameer Rahmani wrote: > is it possible to build a dynamic model in run-time in version 1.1 ? Not sure if it's possible, but you can try messing around with __new__ from django.db import models.base import ModelBase, Model YourModel = ModelBase.__new__(ModelB

Dynamic Model

2010-02-11 Thread Sameer Rahmani
is it possible to build a dynamic model in run-time in version 1.1 ? -- lxsameer -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group,

Re: override django's rear-end validation for dynamic model field (AJAX)

2009-12-24 Thread Maksymus007
On Thu, Dec 24, 2009 at 5:24 PM, hotani wrote: > I have close to 600 users split by 20 or so offices. We have a > helpdesk form (using ModelForm) which displays an initial user list > based on the office, or no users if an office is not selected. > > An AJAX function on the

Re: override django's rear-end validation for dynamic model field (AJAX)

2009-12-24 Thread Daniel Roseman
On Dec 24, 4:24 pm, hotani wrote: > I have close to 600 users split by 20 or so offices. We have a > helpdesk form (using ModelForm) which displays an initial user list > based on the office, or no users if an office is not selected. > > An AJAX function on the front end

override django's rear-end validation for dynamic model field (AJAX)

2009-12-24 Thread hotani
I have close to 600 users split by 20 or so offices. We have a helpdesk form (using ModelForm) which displays an initial user list based on the office, or no users if an office is not selected. An AJAX function on the front end dynamically changes users in the drop-down based on the office

Re: Getting a dynamic model form

2009-07-27 Thread ~Young Devil
Thanks Man!! On Jul 18, 5:24 am, Eugene Mirotin wrote: > So, the value is a string, but the widget you want to display to the > user should be changed according to the key value? > Probably you have to create your custom tag (e.g. render_value_widget) > and then use

Re: Getting a dynamic model form

2009-07-18 Thread Eugene Mirotin
So, the value is a string, but the widget you want to display to the user should be changed according to the key value? Probably you have to create your custom tag (e.g. render_value_widget) and then use something like {% render_value_widget key value %} in your view. If you provide the same name

Getting a dynamic model form

2009-07-17 Thread ~Young Devil
I've a generic model to save the user preference with a key and value However the view would change depending upon the key. Example, key : newsletter view : radio button, yes and no key : template type value: drop down box [blue, white, brown] Is anything like this possible in Django, I am

Re: dynamic model field assignments

2009-04-29 Thread Dennis Schmidt
thanks, that was just what I was looking for :-) never used this**thing before On 29 Apr., 14:02, Daniel Roseman wrote: > On Apr 29, 12:09 pm, Dennis Schmidt > wrote: > > > > > > > Hi Mike, > > > thanks a lot but that was

Re: dynamic model field assignments

2009-04-29 Thread Karen Tracey
On Wed, Apr 29, 2009 at 7:09 AM, Dennis Schmidt wrote: > > Hi Mike, > > thanks a lot but that was unfortunately not what I ment. Your > assignmements are static in > > In [2]: n = TestFun(name="mike", description="Testing is always > fun.") > > but I need them to be

Re: dynamic model field assignments

2009-04-29 Thread Daniel Roseman
On Apr 29, 12:09 pm, Dennis Schmidt wrote: > Hi Mike, > > thanks a lot but that was unfortunately not what I ment. Your > assignmements are static in > > In [2]: n = TestFun(name="mike", description="Testing is always > fun.") > > but I need them to be dynamic. So in

Re: dynamic model field assignments

2009-04-29 Thread Dennis Schmidt
Hi Mike, thanks a lot but that was unfortunately not what I ment. Your assignmements are static in In [2]: n = TestFun(name="mike", description="Testing is always fun.") but I need them to be dynamic. So in the above case NAME wouldn't be hardcoded but come from a dictionary. {'name': 'mike'}

Re: dynamic model field assignments

2009-04-29 Thread Mike Ramirez
On Wednesday 29 April 2009 03:24:48 am Dennis Schmidt wrote: > Hi there, > > this might be a trivial question but my search within the django > documentation and google didn't give me any helpful results. > In Ruby on Rails you can simply do this > > x = Model.new({:param_x => 'x', :param_y =>

dynamic model field assignments

2009-04-29 Thread Dennis Schmidt
Hi there, this might be a trivial question but my search within the django documentation and google didn't give me any helpful results. In Ruby on Rails you can simply do this x = Model.new({:param_x => 'x', :param_y => 'y'}) where the params are some model fields. The hash you can provide

Re: limit_choices_to using a dynamic model attribute

2009-03-30 Thread Jamie
Ah, after playing with the code some more I resolved my own problem. Instead of relying on the 'is_active' dynamic model attribute for use with limit_choices_to, I was able to get the following to accomplish the same task: limit_choices_to={ 'end_date__gte': datetime.date.today, 'start_date__lte

limit_choices_to using a dynamic model attribute

2009-03-30 Thread Jamie
Is it possible to use limit_choices_to with a dynamic model attribute? Some background: I am using a StaffMember model for content creators who do not have user accounts. Each staff member has a start and end date and the model has a dynamic attribute called 'is_active' that compares the start

Re: Dynamic model field

2008-12-27 Thread sergioh
Maybe a better approach for this, can be override the save method for your model and also exclude that field on your forms. Actually there is a post from James Bennett at: http://www.b-list.org/weblog/2008/dec/24/admin/ hope it helps, regards, Sergio Hinojosa On Dec 26, 6:32 pm, eldonp2

Dynamic model field

2008-12-26 Thread eldonp2
I'm writing a library app - would like to find out if it is possible to have a dynamically updating (returndate) field in a model? class Loan... ... borrowdate = models.DateTimeField(auto_now_add = True) returndate = models.DateTimeField(timediff(borrowdate+ timedelta (days=2)) ...

newform dynamic model

2008-03-29 Thread Radim
I need to pass a model to Form class as an attribute, I want to write a generic view. How to do it? class Frm(forms.ModelForm): def __init__(self,model,instance): self.model = model forms.ModelForm.__init__(self,instance=instance) class Meta: model = model # <-

Re: dynamic model calls

2008-01-25 Thread Russell Keith-Magee
On Jan 26, 2008 8:11 AM, Chris <[EMAIL PROTECTED]> wrote: > > Hello, > > I am seeking to do something like this: > > def dynamic_model_call(model_name): > test = model_name.objects.all() > return test > This will work fine as long as you pass an actual model into the method: >>>

dynamic model calls

2008-01-25 Thread Chris
Hello, I am seeking to do something like this: def dynamic_model_call(model_name): test = model_name.objects.all() return test I saw where I could do something like this: def dynamic_model_call(model_name): exec("test = %s.objects.all()" % model_name) return test But this

Re: Dynamic Model Choices

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 19:55 +, kevinski wrote: > Here is my situation: > > I have a model attribute which needs CHOICES to come from another > model. The caveat is, I need to add an addition choice so I cannot set > it as a foreign key. What do you mean here? I don't understand what an

Dynamic Model Choices

2007-07-12 Thread kevinski
Here is my situation: I have a model attribute which needs CHOICES to come from another model. The caveat is, I need to add an addition choice so I cannot set it as a foreign key. How do I set the CHOICES to populate dynamically and add the additional choice. Here is the abbreviated context of

Re: Dynamic Model Fields

2007-04-12 Thread Olivier Guilyardi
Olivier Guilyardi wrote: > I'm still a python newbie, but it seems to me that there could be a way to > modify the model definition before Django knows about it: Okay, I found the Field.contribute_to_class() method which seems to work just fine. I'm calling it right after my model class

Re: Dynamic Model Fields

2007-04-11 Thread Olivier Guilyardi
Tim Chase wrote: >> Actually the labs where just an example: one laboratory will >> have one installation of the application, and the dynamic >> fields will only apply within the scope of this installation. >> There's no such thing as consistency accross labs. > > It still sounds like the above

Re: Dynamic Model Fields

2007-04-11 Thread Olivier Guilyardi
Tim Chase wrote: >> I'm in the process of turning telemeta [1] into a django >> application, and need dynamic model fields: we want to allow >> site administrators to easily add/remove "fields" to our main >> data structure, the MediaItem, which represents an

Re: Dynamic Model Fields

2007-04-11 Thread Tim Chase
> I'm in the process of turning telemeta [1] into a django > application, and need dynamic model fields: we want to allow > site administrators to easily add/remove "fields" to our main > data structure, the MediaItem, which represents an audio/video > resource. > >

Dynamic Model Fields

2007-04-11 Thread Olivier Guilyardi
Hi, I'm in the process of turning telemeta [1] into a django application, and need dynamic model fields: we want to allow site administrators to easily add/remove "fields" to our main data structure, the MediaItem, which represents an audio/video resource. Example: for a give

"dynamic" model, where to put what

2007-02-02 Thread Dill0r
Hi, Though there is a section in the FAQ converning diangos MVC philosphy im still confused. My model is manipulated while my application runs. So how do i manipulate the model from external? Ive written a stop/ wait protocol in python which communicates with the microcontroller that