Hi All,

I'm currently using a MSSQL DB to access some data and am using django's 
inspectdb results. I've had to tweak some of the model but so far things 
have been smooth sailing. Today I needed to run a lookup that spanned 
through some tables forward and reverse and tested the following in shell 
which worked fine:

>python manage.py shellfrom db_ccmdata.models_auto import 
>TbldataAgentperformancebyperiod as agent_performance
agent_performance.objects.filter(fkagent__tblconfigagentgroupmembers__fkagentgroup__name="IT
 Call Centre Immediate")

When I implemented this in my code I started getting a FieldError and am 
confused as hell.

agent_queue = agent_performance.objects.filter(
            midnightstartdate__range=(date + ' 00:00:00', date + ' 
23:59:59')).filter(fkagent__tblconfigagentgroupmembers__fkagentgroup__name='IT 
Call Centre Immediate').order_by('fktimeinterval')

I've checked the relationships are all okay but the perplexing thing is 
that it works in shell as expected.

the relationship is

tbldataagentperformancebyperiod *agentfk* -> *pkey* tblconfigagent *pkey*
 <- *agentfk*tblconfigagentgroupmembers *groupfk* -> *pkey* tblconfiggroup

I'm not sure if it's relevant but doing ./manage.py no longer works and 
manage.py returns ": No such file or directory" (it's definitely 
manage.py/python returning this) so I've been calling it with python 
manage.py etc


Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6061aae0-996b-485c-a971-684cf237b25d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to