Malcolm Tredinnick wrote: > At the moment, the only workaround is to call out to your own shell > script (or other) to do the insert. If you have a look around line 506 > of django/core/management.py, you can see where Django emits a > "post-syncdb" signal after setting up the database, so you can register > a handler for that before calling the setup routines and then do your > own stuff afterwards (include an os.system() or equivalent call). See > [1] for an example of how to use this signal -- although that link isn't > responding for me right now; hopefully it's just being temperamental. > > [1] > http://www.bright-green.com/blog/2006_07_12/initialising_application_data_.html
That's a great pointer. Perhaps this could just be described in the django docs... I'm guessing there are plenty more signals that could be used to do all kinds of useful things. > In the medium-term, I'd like to fix the initial SQL handling, but it's > as trivial as it looks because of differing quoting requirements and the > fact that not all the database shells can be used without user input > (one easy to see case is trying to make a PostgreSQL database with a > password work via psql without requiring user interaction). It might be > fixed "properly" one day, or we may just have to document its > limitations. Trying to write the be-all-and-end-all of database shell > interfaces is probably not worth the effort and maintenance for us > unless it's really easy. I agree, I think it's not worth it. I mean, my code is failing because it's trying to do something out of the ordinary. Having hooks is just fine! - bram --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---

