Oleg Broytmann <[EMAIL PROTECTED]> writes:

> c2 = Classtwo.get(3)
> print c2.things

Is there some way to apply filters to this returned list of records?  As far
as I can see, I have to handle them as a list and loop over the results...  Am
I right?

What I want is given a model that has, e.g., 5 tables and one of these has two
RelatedJoins search data on this table based on data from the other four
tables.

For ForeignKeys I can do something like:

================================================================================
all_records = MyClass.select()
filtered_records = all_records.filter(MyClass.q.field1 == condition)
filtered_records = filtered_records.filter(MyClass.q.field2 == other_condition)
================================================================================


Then, when I include the RelatedJoins I loose this filtering capability.  What
I coded up continues from the above like:


================================================================================
related1 = MyOtherClass.get(related_id).things
temp_list = []
for record in filtered_records:
    if record in related1:
        temp_list.append(record)
filtered_records = temp_list

related2 = YetAnotherClass.get(related_id).things
temp_list = []
for record in filtered_records:
    if record in related2:
        temp_list.append(record)
filtered_records = temp_list
================================================================================


But this last step is really inneficient...  I believe there's a more
efficient way to handle them or even some way to apply the filter method as I
did when I had the SelectResults instances.

Am I too wrong here?

-- 
Jorge Godoy      <[EMAIL PROTECTED]>


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to