On Wed, May 19, 2010 at 8:18 AM, Pep <pepourqu...@gmail.com> wrote: > Hi everybody ! > > I would like to know if it's possible to add automatically a table on > my database when, for example, a new member subscribe on my website ? > > I mean, if I would like to do it manually, I'll have to change my > Model and then to do manage.py syncdb. And that's all. But > automatically ???
Yes you can, as long as you have a model to create. How to do it is a little convoluted, and the need to do this in reality is rare, but here is how I would do it 1) Create a dynamic_models app that has a models.py that only has the required imports 2) During registration at the point you activate the users account you have a method that will append a new model to the dynamic_models models.py file. The model must be uniquely named 3) Then once the new model is in the file call 'call_command('syncdb', verbosity=0, interactive=False)' And poof you have a new model in the DB for each user registered. Details on programmatically calling management commands can be found in the django documentation. Now that I have told you how to do it I would like to hear your use case because there is an 80+% chance you dont need to do this to achieve the results you are looking for. -- 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, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.