Friday, July 31, 2015

Re: How to add fields to an existing model dynamically? Also how to modify existing field of a model dynamically?

you can use a technique from the zope world known as Annotations:
http://davidemoro.blogspot.co.uk/2015/02/kotti-cms-annotations-store-arbitrary-data.html
which basically means that you store additional data in a json field

have a look at:
https://github.com/octobot-dev/pulpo-forms-django
https://github.com/MarkusH/django-dynamic-forms
or https://wagtail.io/


On 31 July 2015 at 04:28, SriPrad <brs.pradeep@gmail.com> wrote:
> Hi,
> Thanks for the quick response.
> I understand that it is not typical to have dynamic model.
> However the requirements I have need to allow the admin to make changes/ create models dynamically.
> I have looked at South library. However my understanding is that it is not supported for Django 1.7 and later versions. It seems that the functionality is merged in Django 1.7.
>
> Please advise.
>
> Regards,
> Srinivasa Pradeep
>
>
>
> On Thursday, July 30, 2015 at 5:08:07 PM UTC+5:30, vicherot wrote:
>> IMHO (maybe i'm wrong) i think that its not quite good modify your database structure dynamically to often, maybe you must to think a better design of your model.
>> I'm working on a Health bussiness in Argentina and never need to
>> change the database structure to modify a medical form. (for now)
>>
>>
>> Now, for your exclusive problem, maybe using south (just like the project you say) you can do the changes to your database dinamically.
>>
>> Regards!
>>
>>
>>
>>
>>
>> --
>> Rafael E. Ferrero
>>
>>
>>
>> 2015-07-30 5:01 GMT-03:00 SriPrad <brs.p...@gmail.com>:
>>
>> Hi,
>> I am new to Django and Python!.
>> I am using Django 1.8.3 along with Python 3.2 and using sqlite as the database.
>> I am trying to setup a site using Django wherein the model is created dynamically( For eg: a Medical form)
>> The fields of the form are stored in db and the model created dynamically (reference: https://github.com/willhardy/dynamic-models)
>> The admin guys can modify the fields of this medical form from the admin site. At this time, I would like to modify the model to match the schema modifications done by admin guys.
>> I understand prior to Django 1.7, there was django.db.models.loading module that helped in this.
>>
>> With the current version of Django, how can I add/modify/delete the fields of the dynamic model dynamically?
>>
>> Your help and suggestions are most welcome.
>>
>> Regards,
>> Srinivasa Pradeep
>>
>>
>>
>>
>>
>> --
>>
>> 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...@googlegroups.com.
>>
>> To post to this group, send email to django...@googlegroups.com.
>>
>> Visit this group at http://groups.google.com/group/django-users.
>>
>> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6a62db2f-5dd7-417c-9d6b-fbbed6b5a149%40googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4d02e9dc-98dc-4120-ad19-caac524bc57c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don't drive species to extinction

2) Don't destroy a habitat that species rely on.

3) Don't change the climate in ways that will result in the above.

}<(((*>

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABCjzWp-ayiRpB%2B3Ab332wKzj4%3DDfQS9k4dArs6Wc1YtaMaXNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment