Re: dynamic fields in models

2007-06-05 Thread Lic. José M. Rodriguez Bacallao
problem resolved, here is how I did it, just a little change to my original code, setattr by add_to_class, with this, I can add common attributes to a lot of models without having to inherit more than once or having a base class for all of them, beside, it just create one table, not two: def commo

Re: dynamic fields in models

2007-06-05 Thread Lic. José M. Rodriguez Bacallao
problem resolved, here is how I did it, just a little change to my original code, setattr by add_to_class, with this, I can add common attributes to lot of models without having to inherit more than once or having a base class for all my models : def common_attrs(cls, common): attrs = dir(comm

Re: dynamic fields in models

2007-06-05 Thread Branton Davis
Cool! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more

Re: dynamic fields in models

2007-06-04 Thread Malcolm Tredinnick
On Mon, 2007-06-04 at 18:36 -0400, Lic. José M. Rodriguez Bacallao wrote: > hi people, I want to do a little thing, I want to add fields > dynamically to a model so when I run python manage.py syncdb, > those fields get added to the database table, for example: > > def common_attrs(cls, comm

Re: dynamic fields in models

2007-06-04 Thread sansmojo
syncdb will not automatically add new fields in a model. You have to add the new fields to the database yourself. 'python manage.py sql' will give you the new sql statements to recreate your models, and you can pick out the part regarding your new fields. Also, if you don't care about existing

dynamic fields in models

2007-06-04 Thread Lic. José M. Rodriguez Bacallao
hi people, I want to do a little thing, I want to add fields dynamically to a model so when I run python manage.py syncdb, those fields get added to the database table, for example: def common_attrs(cls, common): attrs = dir(common) for attr in attrs: if isinstance( getattr(co