On Thu, Apr 21, 2011 at 1:37 PM, octopusgrabbus
<old_road_f...@verizon.net> wrote:
> [...]
>
>    try:
>       cs_hold_rec_count = CsInvHold.objects.count()
>       cs_hold_rec_list = CsInvHold.objects.filter(inventory_ok=0)
>
>    except ObjectDoesNotExist:
>       cs_hold_rec_count = 0
>
>    if request.method == 'POST':
>        if 0 == cs_hold_rec_count:
>            errors.append('There are no customer synch records on
> hold.')
>        else:
>            rc = sendCsHoldRpt(cs_hold_rec_list)

You don't tell us where and how does the behavior of filter()
you claim happens shows itself. e.g. an exception or error that
says ' I expect a queryset here and I got a model instance' .

Maybe it is in your sendCsHoldRpt() function? But you don't
share code tracebacks or debug output. You keep adding
unrelated leads and findings but haven't correctly described
your initial problem. This doesn't make it easy to try to help you.

Also, neither .count() nor .filter() raise ObjectDoesNotExist
so that try/catch block isn´t necessary. .filter() returns
and empty queryset if no model instance matches its
criteria. Maybe the problem is related to that and you are
mis-diagnosing it?

-- 
Ramiro Morales

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to