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
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:
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__)
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
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.
5 matches
Mail list logo