Re: models can't use globals

2006-01-10 Thread limodou
Maybe you should set the module instance in module_constants property, it's described at model-api document in META options section. Or just like what Cheng Zhang shown to import the module in the function scope. -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://gr

Re: models can't use globals

2006-01-10 Thread Russell Keith-Magee
On 1/10/06, Greg <[EMAIL PROTECTED]> wrote: And I could put the import insidemy method, but that's not ideal either. Any thoughts? The local import is the solution I usually fall back on. Is this arestriction that will be lifted by the magic removal branch? Yes. The problem you are experiencing

Re: models can't use globals

2006-01-10 Thread Cheng Zhang
I use such way to get around that. Don't know is there any better ways to do it though. def is_mutual_friend(friend): """ Test whether myself and friend is mutual friend, which means we both are in each other's friend list """ # The next line can't be moved to the top of the file

models can't use globals

2006-01-09 Thread Greg
When writing a method for one of my model classes, I find that I want to access a function from another module. The reference documentation (http://www.djangoproject.com/documentation/model_api/#model-methods) is plenty clear on the fact that you can't just import a module at the top of the model-