Re: Shell not picking up db changes

2006-08-14 Thread cyberco
Wow, that does the trick! Thank you very much. I'm not exactly sure what this command does, though --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djang

Re: Shell not picking up db changes

2006-08-14 Thread Miguel Hernández
Hi cyberco,On 8/13/06, cyberco <[EMAIL PROTECTED]> wrote:> Is there a way to pick up the changes without restarting the shell? Try to commit the current transaction:import django.dbdjango.db.connection._commit()-- Obstáculos es lo que ves cuando apartas la vista del objetivo. --~--~-~--~---

Re: Shell not picking up db changes

2006-08-14 Thread cyberco
Yes, but the disadvantage of using 'import x.y.z as mymodel' instead of 'import x.y.z'b is that instead of using a = A() I have to say a = mymodel.A(). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Shell not picking up db changes

2006-08-14 Thread Jeff Forcier
However, keep in mind Pedro's example, where he uses "import x.y.z as a" and then later calls "reload(a)". In other words, using the "as" functionality of import lets you have the best of both worlds--reload() will work, and you can still get a single-word binding in your namespace for your Model

Re: Shell not picking up db changes

2006-08-13 Thread Malcolm Tredinnick
On Sun, 2006-08-13 at 22:05 +, cyberco wrote: > I may have cheered to early: what if I don't use 'import as', but > 'site.app.models import *'? If I do 'reload(models)' the Django models > are reloaded, and doing 'reload(site.app.models)' throws an exception > saying 'site' does not exist...

Re: Shell not picking up db changes

2006-08-13 Thread cyberco
I may have cheered to early: what if I don't use 'import as', but 'site.app.models import *'? If I do 'reload(models)' the Django models are reloaded, and doing 'reload(site.app.models)' throws an exception saying 'site' does not exist... --~--~-~--~~~---~--~~ You

Re: Shell not picking up db changes

2006-08-13 Thread cyberco
Ah! Thanks for the tip! I totally forgot about Python's reload method because my mind was on a 'db-track' all the time. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, se

Re: Shell not picking up db changes

2006-08-13 Thread Pedro Lima
Module reload works as expected >>> import uatki.blogdata.models as m >>> e = m.Blog.objects.get(id=1) >>> e.test() Traceback (most recent call last): File "", line 1, in ? AttributeError: 'Blog' object has no attribute 'test' [ changed the model to have a test method ] >>> reload(m) >>> e =

Shell not picking up db changes

2006-08-13 Thread cyberco
Using the ipython started from manage.py I noticed that changes to the db are not automatically picked up (added values for instance). I have to restart the shell to pick them up, which also means I have to reimport everything and I loose my shell history. Is there a way to pick up the changes w