Thanks Bill, yes, that is one possible solution, when implementing such feature from the scratch.
I am only asking, if there is some existing framework for such need, which I see as common. For example some add-on to Django, which will do this for me. Let's imagine additional option for any field of Django model, e.g.: class Person(models.Model): firstname = models.CharField(max_length=30, initial_values="John, Bill, Peter") lastname = models.CharField(max_length=70, initial_values="Smith, Clinton, Parker") ... Django with such add-on could be able to build initial database from these values, for example when running syncdb or other way. Am I more readable now? Jano On Aug 20, 10:09 pm, Bill Freeman <ke1g...@gmail.com> wrote: > Perhaps I'm not understanding correctly, but how about, assuming you have a > function > run_data_inits() that calls your chain of init_sample_data() functions: > > $ python manage.py shell > > >>> import myproject.myapp.models as m > >>> m.run_data_inits() > >>> ^D > > Bill > > On Thu, Aug 20, 2009 at 9:25 AM, Jan Ostrochovsky < > > jan.ostrochov...@gmail.com> wrote: > > > Hello, > > > we are in the initial phase of software project, and data model and > > names of attributes are changing very often, and very often we need to > > create new database and fill it with the same sample data for testing. > > We want to automate this creation of sample data. > > > Our idea: add into each models.py method e.g. init_sample_data() to > > each model class, and put sample data there (with well handled > > dependencies - ForeignKey, etc.) and each time we change model, we > > will aslo change concerned init_samle_data(). We will run these > > chained init_sample_data() for each class in the script. > > > The question is: is there some existing solution for this (in Django > > or its extensions), which we can use, and not reinvent it, or not? Any > > idea? > > > (We are using Django Evolution, which is good help, but only when > > changes are not too dramatic.) > > > Thanks in advance. > > > Jan Ostrochovsky --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---