On 8/3/06, Gennan Chen <[EMAIL PROTECTED]> wrote:
Thanks for help. I did feel this hook is kind of strange since the whole idea of using model/DB API is to avoid writing SQL script. 

The other good reason to avoid this is that SQL inserts are somewhat DB specific. My reading is that the original intent of the SQL insert feature is to allow table-level modification ( e.g., manually changing column restrictions), rather than data insertion.

Since initial info I need to put in is some system info (such as host name, ip address...), which are not fixed, I intend to write another py file to do that instead of generating SQL dynamically. However, can I override class's __init__ function? Or I need to create a customized Manager for that?? 

This is an area I hope to do some work on RSN. An ability to populate the database is required for testing purposes, but the ideas I'm playing with wouldn't be testing specific - there would be an option to set up a script that is executed at time of syncdb.

In the meantime, a .sql file is the only option that will be automatically added at syncdb. However, this doesn't mean you can't write a simple 'populate.py' script that contains

a1 = Author(name='Fred')
a1.save()

type logic, and run that script manually when you need to populate the database.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to