ordering a query set randomly

2008-10-17 Thread Orcun Avsar
hi, problem is that i want to order model instances for an attribute and slice it. then sort list randomly. >>query=order_by("date")[:20] >>query.order_by("?") returns an error because query set has been sliced >>query=order_by("date")[:100] >>random.shuffle(query) also returns error bacuse que

"setup_environ" can't help to run a standalone script

2009-01-30 Thread Orcun Avsar
im trying to run a seperate script that is on my project directory. setup_environ seems called correctly but progmram cant import models properly code: from django.core.management import setup_environ import settings setup_environ(settings) from indir.program.models import Program, Hit output:

Re: "setup_environ" can't help to run a standalone script

2009-01-31 Thread Orcun Avsar
On 31 Ocak, 03:09, Malcolm Tredinnick wrote: > I suspect you just haven't set > up your Python path correctly (which is the cause of about 98% of all > import-related problems on this list). > > Regards, > Malcolm i checked my python path and added two path. 1)DIR=os.path.abspath(__file__)

Re: "setup_environ" can't help to run a standalone script

2009-02-15 Thread Orcun Avsar
i added from django.db.models.loading import get_apps get_apps() before calling models and it solved the problem --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send emai

Re: "setup_environ" can't help to run a standalone script

2009-02-15 Thread Orcun Avsar
hi and thanks for advice. however it doesn't seems like the problem because i did set all my python paths correctly and called setup_environ. it was like. this was the top of script before i solved the problem >>DIR=os.path.abspath(__file__) >>sys.path.append(imp.find_module("django")[1]) >>sys.