Test DB Connection

2011-10-14 Thread Julian Hodgson
I've go some python modules which automatically connect to the database then they are loaded beacuse they have an __init__.py with from django.core.management import setup_environ import passion.settings def loadSettings(): s = setup_environ(passion.settings) print s # this should only

Re: Model caching per python session

2011-08-23 Thread Julian Hodgson
FYI: this does the trick: from django.db import connection connection.close() On Tue, Aug 23, 2011 at 12:29 AM, Julian Hodgson < julian.of.lon...@googlemail.com> wrote: > Ok, that makes sense. > > The thing is, we've written some python plugins for Softimage to read and &g

Re: Model caching per python session

2011-08-22 Thread Julian Hodgson
So I really need a way of closing the transaction or flushing the sql in django, without starting a new python session. Any ideas warmly received. Julian. On Aug 22, 2011 8:30 PM, "Daniel Roseman" wrote: > On Monday, 22 August 2011 17:16:24 UTC+1, Julian Hodgson wrote: >>

Model caching per python session

2011-08-22 Thread Julian Hodgson
Hi there, I'm running a production linux django server using wsgi, and have found the following issue. Django version (1, 2, 5, 'final', 0). If I open a python shell I get: >>> from passion.cg.models import * >>> print Sequence.objects.all() [, , , ] But if I go into the admin and delete seque

Initial save()

2011-03-12 Thread Julian Hodgson
I need to set up some default values on a ManyToMany field only when a model is first created. How can I find out in the save() override if the object is being created for the first time? Do I check the table for rows which have self.id or is this not defined till after the save? Julian -- You

TypeError: unhashable type: 'ManyToManyField'

2011-02-24 Thread Julian Hodgson
I'm getting this error message when I try to validate even a brand new project and application. Does this ring any bells with anyone? Windows XP 64 I'm using Django 1.1.1 (but it still happens with 1.1.4) Python 2.6 (winxp 64) In my actual database I can only connect when I remove by ManyToMany