http://www.djangoproject.com/documentation/models/fixtures/
What you are looking for is an initial_data fixture. You need to serialize the default instance of the model you want as JSON and save it in initial_data.json and then it should prepopulate when you run syncdb. On Wed, Jun 4, 2008 at 2:31 PM, djangoer <[EMAIL PROTECTED]> wrote: > > A quick newbie question, > > is there any way that can create a default instance (a pre-specified > instance) in the database once the model is created. In other words, > when we first run the syncdb(or set up the website), an pre-defined > instance is created. > > For example, we have a Book model, > > class Book(models.Model): > author = models.CharField(maxlength = 50) > title = models.CharField(maxlength = 50) > > When the website is first setup, we would like to have one default > "Book" instance in the DB, say Book("John.Smith","COMPUT101"). > > Your help is greatly appreciated. > > > --~--~---------~--~----~------------~-------~--~----~ 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 options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---