On Wed, 2006-08-02 at 16:17 -0700, Gennan Chen 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. 
> 
> 
> 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?? 

Ah, now I understand what you're asking. You're right: you don't need to
do that via custom SQL. You could just create model instances containing
the correct information and then save them to the database. Basically,
you would need to write your own little version of manage.py so that it
ran the syncdb code and then ran your python script (or you could do it
via a shell script if you don't mind mixing languages a little bit).

The initial SQL is great for setting up the database-layer. But if you
do need to do some computation or other Python work, then you might as
well, as you suggest, use the Python interface to do this.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to